我如何触发成功回调上model.save()? [英] How do I trigger the success callback on a model.save()?

查看:80
本文介绍了我如何触发成功回调上model.save()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

this.model.save({
  success: function(model, response){
    console.log('success');
  },
  error: function(){
    console.log('error');
  }
})

该模型是正确的发布到它处理保存在服务器,但成功回调不会被解雇。我需要从服务器发送回来的东西?

The model is correctly posted to the server which handles the save, but the success callback is not fired. Do I need to send something back from the server ?

推荐答案

保存的第一个参数是保存模型上的属性:

The first argument of save is the attributes to save on the model:

this.model.save( {att1 : "value"}, {success :handler1, error: handler2});

这篇关于我如何触发成功回调上model.save()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆