D'Arcy Rail-Ip
D'Arcy Rail-Ip

Reputation: 11955

Send different or extra parameters to Backbone destroy/delete?

Instead of sending the ID as the parameter, I'd like to send in the model to be deleted, similarly to the PUT and POST methods.

Is this possible? If not, is it possible to simply add in extra parameters? To be able to delete from the server I actually need more than just the ID.

Edit: Should I override the destroy method and make my own AJAX call?

Upvotes: 1

Views: 2815

Answers (1)

Moszeed
Moszeed

Reputation: 1037

you could do it with a custom header, like this: https://stackoverflow.com/a/13075029/1067061

just write it in your delete :

model.destroy({
   headers: {
      'param_1': 1,
      'param_2': 2
   }
});

Hope it helps.

Upvotes: 1

Related Questions