First Step: Binding events
Common Ajax-related events are referred to as follows:
1, $ (selector). Click (function)
2, $ (selector). Change (function)
3, $ (selector). KeyUp (function)
4, $ (selector). Submit (function)
Prevents the default action of the Submit button before submitting the form, or returns false, such as:
1. Prevent the default action of the Submit button
$ ("form"). Submit (function (e) {
E.preventdefault ();
});
2. Return False
$ ("form"). Submit (function () {
return false;
});
Detailed jquery event that points out into
The second step: Serialize the form or object into a string, or you can serialize the form to an array of forms;
1. Serialize the form contents to a string
var data = $ ("form"). Serialize ();
2. Serialize a Key/value object:
var str = Jquery.param ({});
3, the form of serialization of the form of an array
var sa = $ ("form"). Serializearray ();
Step Three: Form submission
Form submissions can be parameterized in the following ways:
1, Jquery.ajax ([Settings])
2, Jquery.get (Url,data,success (RESPONSE,STATUS,XHR), DataType)
3, Jquery.post (Url,data,success (RESPONSE,STATUS,XHR), DataType)
4, Jquery.getjson (Url,data,success (DATA,STATUS,XHR))
5, $ (selector). Load (url,data,function (RESPONSE,STATUS,XHR))
6, Jquery.getscript (url,success (response,status))
For detailed Jquery.ajax, click to enter
The simplest form submission method for jquery