1. serialized nested parameters are allowed.
For example, {FOO: ["bar", "Baz"]} Will be serialized into Foo [] = Bar & Foo [] = Baz, instead of serializing it to the previous Foo = Bar & Foo = Baz.
If you want to use the old serialization method, there are three setting methods:CopyCodeThe Code is as follows: jquery. ajaxsettings. Traditional = true;
Jquery. Param (stuff, true );
$. Ajax ({data: stuff, traditional: true });
2. automatically checks the JSON and JavaScript data types.
After 1.4, JSON or Javascript is returned. You do not need to set datatype. The type is automatically determined based on application/JSON or application/X-JavaScript. The data type returned by the background must be specified.
3. html header information can be added.
$. Ajax () adds an attribute ifmodified: True, which is set to true to effectively use the browser cache (I have tried it before .)
4. Use native JSON. parse to parse JSON.
1.4 The validity of the JSON returned by Ajax is verified. The invalid JSON format is not parsed, for example, {FOO: "bar "}.
5 $. serialize () can serialize HTML5 form elements.
...... I have not carefully read HTML5 .....
6. It is very useful to add a new attribute context.
The appearance of context is so timely that context will simplify your Ajax requests. Context allows you to customize the context, that is, specify this of the callback function in Ajax. Let's look at the Code:Copy codeThe Code is as follows: jquery. Ajax ({
URL: "test.html ",
Context: Document. Body,
Success: function (){
Jquery (this). addclass ("done ");
}
});
This in the Code success callback function will point to document. Body
7 explicitly set Content-Type
Before 1.4, if you have not set the data parameter, $. Ajax () will ignore the value of contenttype, and 1.4contenttype will be sent during Ajax requests.
8. You can specify the callback function name of jsonp.
9 by default, cross-origin requests are not allowed.