Skip to content
Permalink
Browse files

jQuery.ajaxSetup() data is merged with params. Fixes #10524

  • Loading branch information...
markelog authored and rwaldron committed May 1, 2012
1 parent dc3c983 commit 6bed348a007f8467dfc09cf63a1783bce673c3f4
Showing with 19 additions and 2 deletions.
  1. +0 −1 src/ajax.js
  2. +19 −1 test/unit/ajax.js
@@ -183,7 +183,6 @@ jQuery.fn.extend({

// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
@@ -1257,6 +1257,24 @@ test("load(String, String, Function)", function() {
});
});

asyncTest("load() - #10524", 1, function() {
jQuery.ajaxSetup({
data: { foo: "bar" }
});

var data = {
baz: 1
};

jQuery("#foo").load( "data/echoQuery.php", data).ajaxComplete(function( event, jqXHR, options ) {
ok( ~options.data.indexOf("foo=bar"), "Data from ajaxSettings was used" );
jQuery.ajaxSetup({
data: null
});
start();
});
});

test("jQuery.get(String, Function) - data in ajaxSettings (#8277)", function() {
expect(1);
stop();
@@ -2411,4 +2429,4 @@ test("jQuery.ajax - active counter", function() {
ok( jQuery.active == 0, "ajax active counter should be zero: " + jQuery.active );
});

}
}

0 comments on commit 6bed348

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.