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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -