0
我正在使用休息服務(POST)將用戶保存到我的服務器的數據庫。用戶被髮送並保存在我的數據庫中,但是響應沒有被正確解釋並且執行停止。一遍又一遍地搜索我的問題的解決方案,但似乎無法找到任何。extjs REST api保存數據
這裏是我的控制器代碼:
{"data":{"username":"xyz","email":"[email protected]","password":"abcd","id":"1"},"success":true,"error":null,"errors":[]}
錯誤說:
addUser: function() {
var form = this.addUserWindow.down('form').getForm();
if (form.isValid()) {
var user = new AP.model.User(form.getValues());
if (user.validate()) {
user.save ({
success: function() {
this.addUserWindow.destroy();// destroys this window
this._reloadStore();// reloads a grid
}
});
}
}
}
在user.save方法,即使數據被公佈和記錄保存,並返回這樣執行停止
Uncaught TypeError: Cannot read property 'data' of undefined
callback ext-all-debug.js:26824
Ext.define.processResponse ext-all-debug.js:26044
(anonymous function) ext-all-debug.js:26240
Ext.apply.callback ext-all-debug.js:5140
Ext.define.onComplete ext-all-debug.js:20950
Ext.define.onStateChange ext-all-debug.js:20912
(anonymous function)
AP.model.User.proxy中的閱讀器是否正確設置? – 2011-06-29 19:46:32