PDA

View Full Version : Ajax call timeout is not working in sencha touch.



shilpay
21 Jul 2011, 11:08 PM
Hi, I am using sencha touch ajax request. Here I used timeout. but its not working. Its never worked.
Ext.Ajax.request({
url: url,
method: type,
dataType:"json",
json:true,
scope:this,
timeout: 30000,
failure : function(response){
},
success: function(response) {
}
})
Is there any issue please help me...

phil.fuse
21 Jul 2011, 11:48 PM
are you trying to delay making the ajax call by 30 seconds?
as looking at the code the timeout in the config is the time for the actual request to complete.
i.e. a timeout in the sense of after 30 seconds assume this has failed rather than a delay.

you probably want to do


setTimeout(function() {
Ext.Ajax.request({
url: url,
method: type,
dataType:"json",
json:true,
scope:this,
failure : function(response) {
},
success: function(response) {
}
});
}, 30000);