我正在使用骨干方法保存来更新parse.com上的用户对象。骨干中的对象基于模型和集合。当我拿到它时可以,但是当保存出现时:PUT https://api.parse.com/1/classes/_User/xj3QLLYy07 400(错误请求)
{ “代码”:206, “错误”: “解析:: UserCannotBeAlteredWithoutSessionError”}
型号:
var Person = Backbone.Model.extend({
urlRoot: "https://api.parse.com/1/classes/_User/",
idAttribute: "objectId",
defaults:{
},
initialize: function() {
console.log("inperson");
// this.upload();
}
});
return Person;
收集:
var Usercollection = Backbone.Collection.extend({
model: Person,
url:'https://api.parse.com/1/classes/_User/',
parse: function(data) {
return data.results;
}
});
return Usercollection;
以及我尝试保存模型的代码:
this.model.save({email:"ciao@lib.it"}, {
// wait:true,
success:function(model, response) {
console.log('Successfully saved!');
},
error: function(model, error) {
console.log(model.toJSON());
console.log(error.responseText);
}
});
答案 0 :(得分:0)
I think this answer needs an update. Cant you just swap the backbone collection and model to Parse's ones?