DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> 超簡單的jquery的AJAX用法
超簡單的jquery的AJAX用法
編輯:JQuery特效代碼     
包括POST,GET,AJAX

前台調用
代碼如下:
jQuery.post("NewDoAjax.aspx", { max: ' N !', name: 'wsenmin' }, function(data) { alert(data) });
jQuery.get("NewDoAjax.aspx", { max: ' B !', name: 'wsenmin' }, function(data) { alert(data) });
var superMan = "max=I am jq &name= it is ajax ";
jQuery.ajax({
type: "POST",
url: "NewDoAjax.aspx",
data: superMan,
success: function(msg) {alert(msg);}
});

C#代碼:(將以下代碼保存為NewDoAjax.aspx文件)
代碼如下:
<%@ Page Language="C#" ValidateRequest="false" EnableSessionState="True"%>
<%@ Import NameSpace="System.Data.SqlClient" %>
<%@ Import NameSpace="System.Data" %>
<%@ Import Namespace="System.Configuration"%>
<%@ Import Namespace="System.Web.Security"%>
<%@ Import Namespace="System.Drawing"%>
<script type="text/C#" runat="server">
protected void Page_LoadComplete(object sender, EventArgs e)
{
Response.ClearContent();
Response.Clear();
string yy = null;
int count = Request.Form.Count;
int count2 = Request.QueryString.Count;
foreach (var cv in Request.Form)
{
yy += cv + ":"+Request.Form[cv.ToString()].ToString()+" 哈好簡單|| ";
}
foreach (var cv in Request.QueryString)
{
yy += cv + ":" + Request.QueryString[cv.ToString()].ToString() + " 好簡單哇哈|| ";
}
Response.Write(yy.Substring(0,yy.Length-4));
Response.End();
}
</script>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved