这是我的模型的身体
urlRoot: '/users',
parse: function(response) {
return response.User;
}
这是我/users/1
在浏览器中输入时返回的内容:
{"User":{"id":"1","created":"2013-02-13 09:22:42","modified":"2013-02-13 09:22:42","username":"somesuername","password":"","role":"somerole","token":null,"token_expiration":null}}
所以api有效。当我执行这个:
this.model.id = 1;
this.model.fetch({ success: function(user){
console.log(user);
}}); // this.model is instance of my model
我进入控制台:
d {cid: "c4", attributes: Object, _changing: false, _previousAttributes: Object, changed: Object…}
_changing: false
_pending: false
_previousAttributes: Object
attributes: Object
__proto__: Object
changed: Object
cid: "c4"
id: Array[1]
__proto__: e
所以结果是模型成功的,没有获取任何数据——我错过了什么吗?