jquery Code Ajax
jquery.post ("newdoajax.asp tutorial X", {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);}
});
asp.net tutorial
<%@ 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 Good simple | |";
}
foreach (var cv in request.querystring)
{
YY + CV + ":" + request.querystring[cv.tostring ()].tostring () + "Good Simple Wow | |";
}
Response.Write (Yy.substring (0,yy.length-4));
Response.End ();
}
</script>
$.ajax () This is the underlying AJAX implementation of jquery. Simple and easy-to-use high-level implementation see $.get, $.post, etc.
Here are a few Ajax event parameters: Beforesend, Success, complete, error. We can define these events to deal well with each of our AJAX requests.
$.ajax ({url: ' stat.php tutorial ',
Type: ' Post ',
Data:{name: "Keyun"},
DataType: ' HTML ',
timeout:1000,
Error:function () {alert (' Error loading PHP document ');
Success:function (Result) {alert (result);}
});
Asp.aspx page Code
Response.ContentType = "application/web effects on"; Response.Write ("{result:" + request["name"] + ", Hello!" (This message comes from server) '} '); jquery code:
$.post ("Ajax.aspx", {action: "POST", Name: "Lulu"}, function (data, textstatus) {//data can be xmldoc, jsonobj, HTML, text Wait a minute. This For this AJAX-requested option configuration information, refer to the This alert (Data.result) as mentioned in Jquery.get (). }, "JSON");
Jquery.post (URL, [data], [callback], [Type]): Asynchronous request using POST method
Parameters:
URL (string): The URL address where the request is sent.
Data (map): (optional) The data to be sent to the server, expressed as a Key/value key-value pair.
Callback (function): (optional) the callback function (which is invoked only if the response return state is success) when loading succeeds.
Type (string): (optional) The official description is: type of data to be sent. The type that should actually be requested for the client (Json,xml, etc.)
This is a simple POST request function to replace the complex $.ajax. Callback functions can be invoked when the request succeeds. If you need to perform a function when an error occurs