How do I trigger the success callback on a model.save()?

前端 未结 8 999
粉色の甜心
粉色の甜心 2020-11-28 23:06
this.model.save({
  success: function(model, response){
    console.log(\'success\');
  },
  error: function(){
    console.log(\'error\');
  }
})

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 23:36

    For those that want to save a model, without updating the attributes, you can do the following:

    model.once("sync", function(model, response, options){
        //
    });
    model.once("error", function(model, response, options){
        //
    });
    model.save();
    

提交回复
热议问题