我是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