View Full Version : How to provide Timeout Alert when the response takes longer time in JSON request

24 Dec 2011, 9:27 AM
The following is my code.... how to provide timeout operation for the JSON request, when the request goes for a while and response is not reached or requested URL is wrong that time i need to show an alert as request timed out....

Timeout as mentioned below is not working in sencha 1.1.0...

Ext.util.JSONP.request({url : loginURL,timeout:20000,callbackKey : 'callback',params : {format : 'json',operations : 'userLogin',userName : emailStr,password : passwordStr,
},callback : function(result) {var response_data = result;if (result.error) {Alert(serverFailure);} else {//PROCESS REQUEST}}}

24 Dec 2011, 9:42 AM
Ext.util.JSONP does not provide a a timeout config.

24 Dec 2011, 10:11 AM
Pls provide me alternative way.....
Javascript timeout function brfore start of json request i tried but with that
Request itself failing and always invoking timeout function...reply

26 Dec 2011, 8:35 PM
javascript timeout function is to call a function after a particular time-interval.

26 Dec 2011, 9:48 PM
You can use javascript setInterval function. Below is the example:

setInterval(function() {
alert('alert after 60 seconds')
}, 60000);

Hope this helps

29 Dec 2011, 5:52 PM
It works fine..thanQ

29 Dec 2011, 8:49 PM
Hello khadarmeeran, if your query is answered, mark it as Answered.