PDA

View Full Version : JSONP.request error/failure action



GNoel
19 Apr 2012, 2:32 AM
Hi

I'm doing a Ext.util.JSONP.request on a php file to execute a request on a database using Sencha Touch 1.
This php file is on a server on a different domain name.



var url = urlBase+"productSearch.php";
Ext.util.JSONP.request({
url: url,
callbackKey: 'jsoncallback',
params: {
format: 'json',
keyword: keywordProduct
},
callback: function(data, status) {
Ext.each(data, function(item,i){
//Some actions
});
},
});


When I execute this normally it's ok, everything what is in the callback work. But when I try this with no connection, for example, I don't know how to execute some actions in case of error.
How can I do that ? I tried failure: and error: but nothing happend.
Is it possible to add a timeout ?

I used to do it whith jquery before and it was possible to do it with error:

Thanks for every response that will be helpfull.

Sorry for my bad english.

mitchellsimoens
19 Apr 2012, 5:41 AM
This was a flaw in ST1 but ST2 this was fixed to use a timeout.

GNoel
19 Apr 2012, 6:07 AM
Ok, thanks

I did a special function that seems to work and do like a timeout.
I will use it even if it's not beautiful, it works

Cheers