why does backbone not send the delete?
Posted
by
Nippysaurus
on Stack Overflow
See other posts from Stack Overflow
or by Nippysaurus
Published on 2012-06-03T21:50:22Z
Indexed on
2012/06/03
22:40 UTC
Read the original article
Hit count: 252
JavaScript
|backbone.js
I have a very basic backbone (sample) application which just creates and destroys model items. When the model is created the object is persisted with a POST to the web server, but when the model is destroyed there is no DELETE sent to the server? Any idea why this might be?
very basic model:
window.User = Backbone.Model.extend({
urlRoot: 'users'
});
my test code just to create and delete the model:
var model = null;
$(".add").click(function(){
if (model == null) {
model = new window.User;
model.set({name: 'meeee'});
model.save();
}
});
$(".remove").click(function(){
if (model != null) {
model.destroy();
}
});
The JSON response when creating the model seems good too:
© Stack Overflow or respective owner