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

Fixes gh-1986
Closes gh-1995
(cherry picked from commit 89ce0af2cf)
This commit is contained in:
George Mauer
2015-01-05 21:00:12 -06:00
committed by Dave Methvin
parent 07719736b7
commit 26150f0910
2 changed files with 23 additions and 2 deletions

View File

@@ -798,13 +798,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 ) );
};
});