Ajax method parameters in jquery, common parameters are as follows:
$.ajax ({ type: "Get", url: ' Http://xxx.xxx.com/xxx/xxx/xxx/personId ', dataType: "JSON", data:{' id ':p ersonid}, success: function (data) { Var result = json.parse (Data.result); var retData = result.retData; $ (". Result"). EQ (0). HTML ( PERSONID); $ (". Result"). EQ (1). HTML (retdata.address); $ (". Result"). EQ (2). HTML ( Retdata.birthday); $ (". Result"). EQ (3). HTML (retdata.sex == "? " : ( retdata.sex== ' F '? ' Female ': ' Male ')); if (result.retmsg == ' success ') { $ (". Result "). EQ (4). HTML (' ID number isLaw number ! '); }else { $ (". Result"). EQ (4). HTML (' ID number is invalid number ! '); } } , error: function () { $ (". Result"). EQ (0). html (personId); $ (". Result"). EQ (4). HTML (' ID number is invalid number ! '); } });
1. Type
A parameter of type string, the request method (post or get) defaults to get.
2. URL
A string that sends the requested address (the default is the current page address).
3, DataType
A string parameter that returns the data type of the server. The following types are available:
XML: Returns an XML document.
HTML: Returns plain text HTML information, and the included script tag is executed when the DOM is inserted.
Script: Returns plain text JavaScript code. Results are not automatically cached. Unless the cache parameter is set. Note When you make a remote request (not under the same domain), all post requests are converted to get requests.
JSON: Returns the JSON data.
JSONP:JSONP format. When a function is called using the Sonp form, for example Myurl?callback=?,jquery will automatically replace the latter "?" is the correct function name to execute the callback function.
Text: Returns a plain text string.
4.data
An object or string type parameter that is sent to the server for data. If it is not a string, it is automatically converted to a string format.
The GET request will be appended to the URL. The object must be in key/value format, for example {foo1: "Bar1", Foo2: "Bar2"} to &foo1=bar1&foo2=bar2. In the case of arrays, jquery automatically corresponds to the same name for different values. For example {foo: ["Bar1", "Bar2"]} is converted to &FOO=BAR1&FOO=BAR2.
5, success
A function-type parameter that is called after the request succeeds.
6. Error
The function type parameter that is called when the request fails.
More parameter Details view: http://www.cnblogs.com/tylerdonet/p/3520862.htm
Ajax method parameters in jquery Learn