diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2015-02-11 16:40:40 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2015-02-15 02:06:34 +0300 |
commit | fd80f5970f38ff12c7fa2caa8c1de955301a6979 (patch) | |
tree | 15b209f058a1da4ca9779e0382a7e97eb0e26fd0 /src/ajax/load.js | |
parent | 1d3d2b1aa6bcd4de9e3a2d16f98685ac8726311c (diff) | |
download | jquery-fd80f5970f38ff12c7fa2caa8c1de955301a6979.tar.gz jquery-fd80f5970f38ff12c7fa2caa8c1de955301a6979.zip |
Ajax: replace "jqXHR.complete" callback with "always"
Since it was deprecated since 1.8.
Also add additional comments which explains tricky
behaviour of "always" callback
(cherry-picked from 97ef1f2612a9c5bd453d34146fdfd552cf9cee67)
Closes gh-2033
Diffstat (limited to 'src/ajax/load.js')
-rw-r--r-- | src/ajax/load.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ajax/load.js b/src/ajax/load.js index 9d868a5dd..d9c4550fb 100644 --- a/src/ajax/load.js +++ b/src/ajax/load.js @@ -66,7 +66,10 @@ jQuery.fn.load = function( url, params, callback ) { // Otherwise use the full result responseText ); - }).complete( callback && function( jqXHR, status ) { + // If the request succeeds, this function gets "data", "status", "jqXHR" + // but they are ignored because response was set above. + // If it fails, this function gets "jqXHR", "status", "error" + }).always( callback && function( jqXHR, status ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); }); } |