jquery encapsulates Ajax operations in jquery, where the $.ajax () method belongs to the lowest-level method, the second layer is the load (), the $.get (), and the $.post () method, the third layer is the $.getscript (), the $.getjson () method, The second-tier approach is highlighted because of its high utilization rate.
1. Load () method
Function: Loads the remote HTML code and inserts it into the DOM, with the following structure:
Load (URL [. data] [. callback]);
The load () method is passed according to the parameter data from the specified, if there is no parameter passed, the use of a Get method, or vice versa, will be automatically converted to post mode.
2, $.get () method and $.post () method
The difference is as follows:
1) The GET request passes the parameter after the URL, while the POST request is sent to the Web server as the entity content of the HTTP message, but in Ajax, the difference is not visible to the user;
2) The Get mode has a size limit on the transmitted data (usually not >2kb), and the amount of data passed by post is much larger than get (theoretically unrestricted);
3) The data requested by the Get method is cached by the browser, so that other people can read the data from the browser's history, such as account number and password. In some cases, the Get method can lead to serious security problems, and post is a relatively safe way to avoid these problems.
4) Get mode and post method of the data passed on the server is not the same, in PHP, get data can be obtained with $_get[], and post data can be obtained by $_post[], both ways can be obtained by $_request[].
Jquery&ajax applications