grammar
jQuery.post(
url
,
data
,
success(data, textStatus, jqXHR)
,
dataType
)
parameter | describe |
---|---|
url | Required. Specifies which URL to send the request to. |
data | Optional. Map or string value. Specifies the data to send to the server along with the request. |
success(data, textStatus, jqXHR) | Optional. Callback function to execute when the request is successful. |
dataType | Optional. Specifies the data type of the expected server response.
Smart judgment (xml, json, script or html) is performed by default.
|
Depending on the MIME type of the response, the return data passed to the success callback function varies, which can be an XML root element, a text string, a JavaScript file, or a JSON object. The text status of the response can also be passed to the success callback function.
Note: Due to browser security limitations, most "Ajax" requests obey the same-origin policy; requests cannot successfully retrieve data from a different domain, subdomain, or protocol.
Note: If a request initiated by jQuery.post() returns an error code, there will be no notification unless the script has called the global .ajaxError() method . Or as of jQuery 1.5, the .error() method of the jqXHR object returned by jQuery.post() can also be used for error handling.