AJAX, asynchronous Javascript and XML, enables no Refresh Status update page and asynchronous commit
Advantages:
No plug-in support required
The user experience is very good
Improve Web program performance
Ease the burden on servers and broadband
Disadvantages:
The forward Back button is corrupted
Search engine support is not enough
Lack of development debugging tools
Synchronous and asynchronous
Sync: That is, you have to do one thing, wait till the last piece is done before you do the next thing.
Asynchronous: No need to wait until the first thing is done, but do something
jquery has three-tier encapsulation of Ajax
Bottom: Encapsulates some of the basic AJAX operations;
Global method: $.ajax ()
The submitted data is submitted by post, and the data submitted must be "{}" wrapped and submitted in the form of "Key:value".
When submitting an entire form, you can use the form to serialize "serialize ()" To submit the entire form
decodeURIComponent (): Data that is serialized
encodeURIComponent (): Serialization of data, Serialize () is also called this method for serialization
Serializearray (): form converted to JSON
$.ajaxsetup (): Initializes the data for $.ajax () to set the default value of the $.ajax () object
Layer Two: Ajax encapsulated in jquery;
Local method:. Load (Url,data,callback)
Comparison of asynchronous fetching for static files
Global approach: $.get (Url,data,callback,type), $.post (Url,data,callback,type)
Can be obtained asynchronously with a dynamic file
Third layer: encapsulation of get;
Global method: $.getjson,$.getscript
Load Request
$ (document). Ajaxstart (function): The method that is triggered when the request starts
$ (document). Ajaxstop (function): method that is triggered at the end of a request
JSON and JSONP
When datatype is JSON, data cannot be fetched across domains, and "callback=" can be added after adding a domain name to enable Cross-domain call data. When datatype is JSONP, cross-domain fetch data can be realized directly.
JQXHR objects
The properties and methods of the JQuery JQXHR object
The above mentioned is the entire content of this article, I hope you can enjoy.