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

This commit is contained in:
Oleg 2012-05-01 14:39:45 -04:00 committed by Rick Waldron waldron.rick@gmail.com
parent dc3c983be0
commit 6bed348a00
2 changed files with 19 additions and 2 deletions

View File

@ -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";
}
}

View File

@ -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();