我是sencha touch2的新手,我使用Ajax Post Request進行代理,並且能夠獲取Json數據。但我的成功和失敗功能沒有被調用?任何想法我怎麼能做到這一點? 這裏是我的模型供您參考:Sencha touch2:Ajax發送請求成功和失敗的函數沒有被調用?
Ext.define('TestApp.model.ModelList', {
extend: 'Ext.data.Model',
xtype:'modelList',
config: {
fields:['work'],
proxy:{
type:'ajax',
method: 'POST',
url:'http://localhost:9090/apps/works',
callbackKey: 'callback',
actionMethods: {
create : 'POST',
read : 'POST', // by default GET
update : 'POST',
destroy: 'POST'
},
headers: {
'Content-Type': 'application/xml',
'Accept':'application/json'
},
callback: function(options, success, response) {
console.log('999999999'+response.responseText);// not getting called
},
success: function(response) {
console.log('success++++');// not getting called
},
failure: function(response) {
console.log('failure++++');// not getting called
},
reader:
{
type:'json'
}
}
}
});
使用Chrome開發者工具。打開網絡選項卡。重新加載您的網頁或激發您的請求。看看網絡流量。怎麼了? – 2013-04-10 19:20:55
服務器返回什麼? – Izhaki 2013-04-10 21:25:23
是下面的答案有幫助嗎? – dbrin 2013-05-09 20:49:58