Including POST, GET, AJAX
Frontend call
Copy codeThe Code is as follows:
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 # code: (Save the following code as a NewDoAjax. aspx file)
Copy codeThe Code is as follows:
<% @ 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 () + "Ha is simple | ";
}
Foreach (var cv in Request. QueryString)
{
Yy + = cv + ":" + Request. QueryString [cv. ToString ()]. ToString () + "easy to use. Wow | ";
}
Response. Write (yy. Substring (0, yy. Length-4 ));
Response. End ();
}
</Script>