i'm having a problem with destroy method. I can save and see the HTTP activity in my firebug but when i use destroy method i can't see anything. Can anybody explain why ?
Backbone.emulateHTTP = true;
Backbone.emulateJSON = true;
var Hacker = Backbone.Model.extend({
url:"http://localhost/backbone051/save.php",
});
var hacker = new Hacker();
hacker.set({name:"Herman Ganteng",age:"23"});
hacker.destroy(); //doesn't show any activity :(
Your model has no Id field. Typically the Id would be populated by a previous fetch call. In this trivial example you could hard code one like this:
var Hacker = Backbone.Model.extend({
id: "something",
url:"http://localhost/backbone051/save.php",
});
This will result in a POST at the url specified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With