Skip to content

Commit fd80f59

Browse files
committed
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 97ef1f2) Closes gh-2033
1 parent 1d3d2b1 commit fd80f59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ajax/load.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ jQuery.fn.load = function( url, params, callback ) {
6666
// Otherwise use the full result
6767
responseText );
6868

69-
}).complete( callback && function( jqXHR, status ) {
69+
// If the request succeeds, this function gets "data", "status", "jqXHR"
70+
// but they are ignored because response was set above.
71+
// If it fails, this function gets "jqXHR", "status", "error"
72+
}).always( callback && function( jqXHR, status ) {
7073
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
7174
});
7275
}

0 commit comments

Comments
 (0)