Skip to content

Instantly share code, notes, and snippets.

@menacestudio
Created March 12, 2013 22:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save menacestudio/5147688 to your computer and use it in GitHub Desktop.
Save menacestudio/5147688 to your computer and use it in GitHub Desktop.
Backbone: Override AJAX methods
/** 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