Common wording
$.ajax ({
"url": URL,
"Data":d ATA,
"Type": "Post",
ContentType: "JSON",
"Success": Function (resp, textstatus, xmlHttp) {
},
"Error": Function (XmlHttp, Textstatus, exception) {
alert (xmlhttp.status);
}
});
$.get (URL, data, function (RESP, textstatus, xmlHttp) {
}, "JSON");
$.post (URL, data, function (RESP, textstatus, xmlHttp) {
}, "JSON");
Jquery-ajax submitting an instance
$ ("#myform"). Submit (function () {
Serialization of Forms
var data = $ ("#myform"). Serialize ();
Defining the Request URL
var url = "Login";
Calling jquery's Ajax request method
$.ajax ({
"Data":d ATA,
"Type": "Post",
"url": URL,
"DataType": "JSON",
"Success": Function (resp, textstatus, xmlHttp) {
$ ("#res"). html (RESP);
},
"Error": Function (XmlHttp, Textstatus, exception) {
alert (xmlhttp.status);
}
});
Cancel submission of a form
return false;
});
Basic Jquery-get Commit instance, like post, change function name $.post
$ ("#myform"). Submit (function () {
var data = $ ("#myform"). Serialize ();
var url = "Login";
$.get (Url,data, function (resp, textstatus, xmlHttp) {
Alert (resp+ "," +textstatus+ "," +xmlhttp.status ");
});
Cancel submission of a form
return false;
});
Basic Jquery-load Commit Instance
$ ("#myform"). Submit (function () {
var data = $ ("#myform"). Serialize ();
var url = "Login";
$ ("#res"). Load (URL, data, function (RESP, textstatus, xmlHttp) {
Alert ("Hello");
Alert (resp+ "," +textstatus+ "," +xmlhttp.status ");
});
Cancel submission of a form
return false;
});
Ajax-A jquery-based example