From: Oleg Gaidarenko Date: Wed, 11 Feb 2015 13:40:40 +0000 (+0300) Subject: Ajax: replace "jqXHR.complete" callback with "always" X-Git-Tag: 3.0.0-alpha1~114 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97ef1f2612a9c5bd453d34146fdfd552cf9cee67;p=jquery.git 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 Closes gh-2033 --- diff --git a/src/ajax/load.js b/src/ajax/load.js index 595061443..f8f0c396a 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 ] ); }); }