Ajax: $.post and $.get can now take an options object

Fixes gh-1986
Closes gh-1995
This commit is contained in:
George Mauer
2015-01-05 21:00:12 -06:00
committed by Dave Methvin
parent bb928bde7e
commit 89ce0af2cf
2 changed files with 23 additions and 2 deletions

View File

@@ -796,13 +796,14 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
data = undefined;
}
return jQuery.ajax({
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
}, jQuery.isPlainObject( url ) && url ) );
};
});