jquery - Backbone model is destroyed even on service error -
i'm trying destroy backbone model , gets destroyed on service error.
view : this.listento(this.collection, 'remove', function() {}); this.model.destroy({ success : function(model) { /* remove li view */ }, error : function() {} });
in above case model removed collection whether success/error.
suppose if destroy callback fails model should not removed collection. how can achieved?
pass {wait: true} if you'd wait server respond before removing model collection:
view : this.listento(this.collection, 'remove', function() {}); this.model.destroy({ success : function(model) { /* remove li view */ }, error : function() {}, wait:true });
Comments
Post a Comment