Skip to content

Instantly share code, notes, and snippets.

@handleman
Forked from menacestudio/backbone_ajax1.js
Last active August 29, 2015 14:12
Show Gist options
  • Save handleman/f25d8b2fd861dbb16356 to your computer and use it in GitHub Desktop.
Save handleman/f25d8b2fd861dbb16356 to your computer and use it in GitHub Desktop.
/** 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