diff options
author | jaubourg <j@ubourg.net> | 2012-04-02 01:54:19 +0200 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2012-04-02 01:54:19 +0200 |
commit | 395612bb152660226b93f7f096cd0146fc06991e (patch) | |
tree | 12a7c301f48a461245f69857a840e5d6e76e24da /src/ajax.js | |
parent | a29d482894a844724f4386f2fed0edf9cf70c069 (diff) | |
download | jquery-395612bb152660226b93f7f096cd0146fc06991e.tar.gz jquery-395612bb152660226b93f7f096cd0146fc06991e.zip |
$.ajax now always returns an object implementing the Promise interface. Fixes #10944. Unit tests amended.
For back-compat, in case of an early abort, callbacks passed in the options are not called (while subsequent callbacks attached to the returned Promise are).
For early abort triggered by returning false in beforeSend, statusText is "canceled".
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ajax.js b/src/ajax.js index 2bcc1d0a2..ca9b63322 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -643,7 +643,7 @@ jQuery.extend({ // If request was aborted inside a prefilter, stop there if ( state === 2 ) { - return false; + return jqXHR; } // We can fire global events as of now if asked to @@ -717,8 +717,8 @@ jQuery.extend({ // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already - jqXHR.abort(); - return false; + done( 0, "canceled" ); + return jqXHR; } |