One, $.get (Url,[data],[callback])
Initiates a get operation to the server.
Description: The URL is the request address, data is the list of request data (JSON object), callback is the callback function after the successful request, the function accepts two parameters, the first is the data returned by the server, the second parameter is the state of the server, is an optional parameter.
Ii. $.getjson (Url,[data],[callback])
Initiates a get operation to the server.
Note that the return data format requirements for the server are different for the GET or Getjson methods.
In the case of the Getjson method, the server is asked to return a valid JSON-formatted string, so that the first argument back to the function callback is actually the object data that has been converted to JS, no longer the original string. If the server returns a non-legitimate JSON format string, the browser will not be able to obtain the data successfully.
In the case of a GET method, the server returns a string of any format, since the first argument back to the function callback is the original string content, which needs to be handled if it is to be processed (such as a JS object).
Note: Regardless of the AJAX request, the bottom of the server is the string content returned. Just the difference in string format, such as HTNL format, XML format, JSON format.
Three, $.post (Url,[data],[callback],[type])
Initiating a POST request to the server
Note: This function is similar to the $.get () parameter, has a type parameter, type is the requested data type, can be Html,xml,json, and so on, if we set this parameter to: JSON, then the format required to return the server must be in a valid JSON format, The converted JSON object is then acquired in callback.
If not set, just like $.get (), the server can return a string in any format, and the original string is obtained in callback.
Iv. $.ajax (Opiton)
Description: $.ajax () This function is powerful, it can be a lot of precise control of Ajax. Formats such as:
V. $.getscript (URL, [callback])
The GetScript () function can be loaded remotely into JavaScript scripts and executed. This function can load JS files across domains. The meaning of this function is huge, it can greatly reduce the amount of code that the page loads initially, because you can load the corresponding JS file according to the user's interaction, without having to load it all when the page is initialized. The parameter URL is the address of the JS file to be loaded, and callback is (optional) the callback function after the successful load.
Vi. jquery object. Load (URL, [data], [callback])
The load function can load static page content into a specified jquery object. Where URL is requested by the URL of the HTML page, data is (optional) the request parameter, callback is (optional) after the completion of the callback function.
Several ways to Jquey Ajax requests