Commit cb0fbbba authored by Jörn Zaefferer's avatar Jörn Zaefferer

Return XMLHttpRequest from $.ajax() to allow aborting etc.

parent c119a80e
...@@ -586,6 +586,10 @@ jQuery.extend({ ...@@ -586,6 +586,10 @@ jQuery.extend({
* means of making AJAX requests using jQuery. $.ajax() takes one property, * means of making AJAX requests using jQuery. $.ajax() takes one property,
* an object of key/value pairs, that're are used to initalize the request. * an object of key/value pairs, that're are used to initalize the request.
* *
* $.ajax() returns the XMLHttpRequest that it creates. In most cases you won't
* need that object to manipulate directly, but it is available if you need to
* abort the request manually.
*
* These are all the key/values that can be passed in to 'prop': * These are all the key/values that can be passed in to 'prop':
* *
* (String) type - The type of request to make (e.g. "POST" or "GET"). * (String) type - The type of request to make (e.g. "POST" or "GET").
...@@ -701,7 +705,7 @@ jQuery.extend({ ...@@ -701,7 +705,7 @@ jQuery.extend({
* }); * });
* *
* @name $.ajax * @name $.ajax
* @type undefined * @type XMLHttpRequest
* @param Hash prop A set of properties to initialize the request with. * @param Hash prop A set of properties to initialize the request with.
* @cat AJAX * @cat AJAX
*/ */
...@@ -836,6 +840,9 @@ jQuery.extend({ ...@@ -836,6 +840,9 @@ jQuery.extend({
// Send the data // Send the data
xml.send(s.data); xml.send(s.data);
// return XMLHttpRequest to allow aborting the request etc.
return xml;
}, },
// Counter for holding the number of active queries // Counter for holding the number of active queries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment