Skip to content

Instantly share code, notes, and snippets.

@rogelio2k
Forked from sap1ens/backbone-custom-method.js
Last active August 29, 2015 14:24
Show Gist options
  • Save rogelio2k/a61c36378966289252c0 to your computer and use it in GitHub Desktop.
Save rogelio2k/a61c36378966289252c0 to your computer and use it in GitHub Desktop.
var MyModel = Backbone.Model.extend({
someMethod: function(opts) {
var url = this.url() + '/someMethod',
// note that these are just $.ajax() options
options = {
url: url,
type: 'POST'
};
// add any additional options, e.g. a "success" callback or data
_.extend(options, opts);
return (this.sync || Backbone.sync).call(this, null, this, options);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment