[英]Model save backbone
I'm saving a model on a online db Parse.com. 我正在在线db Parse.com上保存模型。 The save function works perfectly but the callback function inside save are not called.
保存功能可以完美运行,但不会调用保存内部的回调函数。
this.utente.save( {
success: function (persona) {//never called
console.log("modello salvato nel db");
console.log(persona);
},
error: function (data){//never called
console.log(data)
}
});
Backbone.Model#save
takes options in the second argument: Backbone.Model#save
在第二个参数中采用选项:
save
model.save([attributes], [options])
保存
model.save([attributes], [options])
Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync .
通过委派给Backbone.sync将模型保存到数据库(或替代的持久层)中。
If you want to call save
without any particular attributes and you want to supply options
, say: 如果要调用不带任何特定属性的
save
并且要提供options
,请说:
model.save(null, { ... })
You probably want to say: 您可能想说:
this.utente.save(null, {
success: function (persona) { ... },
error: function (data) { ... }
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.