This is really a shorthand Ajax operate, that is equal to:
$.ajax(type: 'POST', url: url, data: data,
Tiffany Bracelet, success: success, dataType: dataType);
The good results callback perform is handed the returned data, that will be an XML root component or perhaps a text string dependant upon the MIME sort of the reaction. It is usually passed the text standing from the response.
As of jQuery one.5, the achievement callback function is additionally handed a "jqXHR" object (in jQuery one.4, it absolutely was handed the XMLHttpRequest object).
Most implementations will specify a achievement handler:
$.article('ajax/test.html', perform(info) $('.result').html(data););
This case in point fetches the requested HTML snippet and inserts it within the web page.
Pages fetched with Post are in no way cached, so the cache and ifModified options in jQuery.ajaxSetup() don't have any influence on these requests.
The jqXHR Object
As of jQuery 1.five,
Tiffany Sydney, all of jQuery's Ajax techniques return a superset in the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.publish() implements the Assure interface, giving all of it the attributes, methods,
Tiffany Blue, and habits of a Assure (see Deferred object for far more info). For convenience and consistency together with the callback names used by $.ajax(), it supplies .error(), .accomplishment(), and .total() methods. These methods have a function argument that is certainly known as once the request terminates, and the function gets the identical arguments because the correspondingly-named $.ajax() callback.
The Promise interface in jQuery 1.5 also makes it possible for jQuery's Ajax approaches, like $.submit(),
Tiffany Australia, to chain several .achievement(), .complete(), and .error() callbacks on the single request, as well as to assign these callbacks following the request might have finished. If the request is currently total,
Tiffany Heart, the callback is fired right away.
// Assign handlers right away soon after generating the request,
Hosted Apps – sourceforge, // and don't forget the jqxhr object for this request var jqxhr = $.article("example.php", operate() alert("success");) .success(purpose() alert("second success");) .error(perform() alert("error");) .total(purpose() alert("complete");); // complete other function here ... // Set one more completion operate to the request above jqxhr.full(operate()alert("second complete"););