aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2012-05-02 02:29:12 +0200
committerjaubourg <j@ubourg.net>2012-05-02 02:29:12 +0200
commit9cb1ab436d0a791518ebe7b401fd169c39a356d9 (patch)
treefe76cd833a28285991fb750505aa4781c60c315a
parentd3e034f6c7b086ae772bf22d37f849a2d0ab5194 (diff)
downloadjquery-9cb1ab436d0a791518ebe7b401fd169c39a356d9.tar.gz
jquery-9cb1ab436d0a791518ebe7b401fd169c39a356d9.zip
Fixes the parameters given to load callback when the request errors.
-rw-r--r--src/ajax.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 84a2c0432..77e4d33e3 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -167,7 +167,8 @@ jQuery.fn.extend({
var selector, type,
self = this,
- off = url.indexOf(" ");
+ off = url.indexOf(" "),
+ response;
if ( off >= 0 ) {
selector = url.slice( off, url.length );
@@ -193,9 +194,17 @@ jQuery.fn.extend({
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
- data: params
+ data: params,
+ complete: function( jqXHR, status ) {
+ if ( callback ) {
+ self.each( callback, [ status === "success" ? response : jqXHR.responseText, status, jqXHR ] );
+ }
+ }
}).done(function( responseText ) {
+ // Save response text for use in complete callback
+ response = responseText;
+
// See if a selector was specified
self.html( selector ?
@@ -212,10 +221,6 @@ jQuery.fn.extend({
// If not, just inject the full result
responseText );
- }).always(function() {
- if ( callback ) {
- self.each( callback, arguments );
- }
});
return this;