-
14 Jul 2010 6:18 AM #1
How to set the jsonp request timeout?
How to set the jsonp request timeout?
I use Ext.util.JSONP.request() to do a cross domian json requeat, I want to know how to set the timeout, the defaule timeou is 30 sec? it is too long for me ! and I also to know how to set the timeout callback.
thanks
-
14 Jul 2010 6:39 AM #2
Currently it's unsupported. You'd need to modify the request method so that it would run a delayed task to check if the request had succeeded by the timeout duration.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
14 Jul 2010 7:29 AM #3
-
14 Jul 2010 7:45 AM #4
You'll see it inserts a script tag, remove the script tag from the document.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
26 Jul 2011 4:53 AM #5
How to set the jsonp request timeout?
How to set the jsonp request timeout?
Hello lansea,
I solve the problem on this way.
First before the request start I set a timer:
alertTimerId = window.setTimeout("timeout_req()", 5000); // for 5 sec
In the function timeout_req I call the callback manually:
Ext.util.JSONP.callback({'error':'timeout'});
For my issue it seems it works. Maybe it is a help for you , too.
best regards
Thomas
-
30 Aug 2011 6:34 AM #6
Hello ITS Telco.
I use you code.
But Google Chrome show an error
"Uncaught TypeError: Cannot read property 'callback' of null"
and I also found out the method callback() in the file Ext.util.JSONP.js.
how can it be?
Thanks.
-
30 Aug 2011 7:21 AM #7
Ext.util.JSONP.request and timeout
Ext.util.JSONP.request and timeout
Hello wuyahuang,
it is an example for an Ext.util.JSONP.request.
If the timer finished the timeout_req function.
Unfortunately the Ext.util.JSONP.request do not notice this.
So I call in the timeout_req function a callback for the Ext.util.JSONP.request.
Of course the Ext.util.JSONP.request and the callback there must be declared.
Hope it helps.
best regards
Thomas
-
30 Aug 2011 5:46 PM #8
Hey Thomas.
Thank you for you reply.But I am an newbie about sencha touch.
I don't know how to declared function callback.
can you tell me something about this?
this is my code:
timer = setTimeout("timeout_req()", 5000);
Ext.util.JSONP.request({
url: serverUrl,
callbackKey: 'callback',
scope: this,
params: params,
callback: function(returnObj){
//to do
}
});
function timeout_req(){
Ext.util.JSONP.callback({'error':'timeout'});
}
best regards
wuyahuang
-
30 Aug 2011 8:08 PM #9
Thank you Thomas.I solve the problem.
This is my code:
var timeOutTimer = window.setTimeout(function (){
console.log('time out.');
}, 5000);
Ext.util.JSONP.request({
url: serverUrl,
callbackKey: 'callback',
scope: this,
params: params,
callback: ajaxRequestCallback(timeOutTimer)
});
function ajaxRequestCallback(timeOutTimer){
return function(returnObj, i){
window.clearTimeout(timeOutTimer);
//to do
}
}
Similar Threads
-
Help With JSONP Request
By indieangler in forum Sencha Touch 1.x: DiscussionReplies: 5Last Post: 7 Jul 2010, 11:03 AM -
Help With JSONP Request and Basics
By indieangler in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 6 Jul 2010, 1:46 PM -
Feature request - timeout for treeloader
By zombeerose in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 10 Jun 2009, 3:42 PM -
Ajax request timeout?
By eyp in forum Ext 2.x: Help & DiscussionReplies: 5Last Post: 26 Nov 2007, 7:33 AM


Reply With Quote
