1 allows for serialization of nested parameters.
For example: {foo: [' Bar ', ' Baz ']} will be serialized into Foo[]=bar&foo[]=baz instead of serialized into previous Foo=bar&foo=baz.
If you want to use the old serialization method, there are three ways to set it up:
Copy Code code as follows:
JQuery.ajaxSettings.traditional = true;
Jquery.param (stuff, true);
$.ajax ({data:stuff, traditional:true});
2 automatically detects the data types of JSON and JavaScript.
After 1.4 returns JSON or JavaScript can not be set datatype, will automatically judge the type according to Application/json or Application/x-javascript. However, the data types returned in the background must be specified.
3 support for adding HTML header information.
$.ajax () Adds a new property ifmodified:true, set to true, to efficiently use the browser cache (I've tried to do that now.) )
4 Use native Json.parse to parse json.
1.4 Verifies the validity of the Ajax returned JSON, and the wrong JSON format will not parse, such as {foo: "Bar"}.
5 $.serialize () when serializing a form, you can now serialize HTML5 form elements.
...... Quite with the times, HTML5 I have not seriously read ...
6 Note Add a new attribute context, very useful
The context is so timely that the context simplifies your AJAX requests. The role of the context is that you can customize the contexts that specify this for the callback function in Ajax. Look at the code:
Copy Code code as follows:
Jquery.ajax ({
URL: "Test.html",
Context:document.body,
Success:function () {
JQuery (This). AddClass ("Done");
}
});
The This in the code success callback function points to document.body
7 Explicitly set Content-type
Before 1.4, if you do not set the parameter Data,$.ajax () will ignore the value of contenttype this parameter, 1.4contentType in the AJAX request to send.
8 You can specify the name of the callback function of the JSONP
9 cross-domain requests are not allowed by default