我有以下保存:
var saveResponse = rene.save({
success: function(response, opts) {
console.log('The Child was saved, response: '+response);
},
failure: function(response, opts) {
console.log('The Child save was a failure response: '+response);
console.log('The Child save was a failure opts: '+opts);
}
});
服务器验证发送的数据,如果出现任何错误,它会返回:
{"validationErrors":{
"phoneNumber":"Account with this email already exists",
"birthDateString":"Use following format: yyyy-MM-dd. Example: 2012-11-22"}
}
但是 save 方法有以下 API,它只返回:
http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Model-method-save
"...它们都将被调用,模型和操作作为参数。",
所以我的问题是:
当它只为我提供模型时,如何获得响应(上面的 JSON)作为回报(我假设它只给我我在帖子正文中发送的原始 json,因为我不返回完整的模型作为回报)?是我忽略了什么,还是从语义的角度来看 REST POST 请求不应该失败(这里:验证错误)?