Created
March 12, 2013 22:30
-
-
Save menacestudio/5147688 to your computer and use it in GitHub Desktop.
Backbone: Override AJAX methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Global override to make all AJAX calls as POST type */ | |
Backbone.ajax = function() { | |
var args = Array.prototype.slice.call(arguments, 0); | |
return Backbone.$.ajax.apply(Backbone.$, _.extend(args, {type: 'POST'})); | |
}; | |
/** Manual override per call */ | |
Collection.fetch({data: {id: 34}, type: 'POST'}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment