thank's i'll give it a try ... stay tuned :D
On 27 Gen, 22:45, Ricardo Tomasi <ricardob...@gmail.com> wrote: > Hi Stefano, I think I found a solution. All you need to do is check if > the callback has been called after your specified timeout. If it has > not been called yet, overwrite it with an empty function, else do > nothing. That will mess up with any further usage of the callback, but > it works for this case anyway, take a look: > > http://jsbin.com/ukehu/http://jsbin.com/ukehu/edit > > Change the timeout: 1 in the $.jsonp() call to a short/long value to > test it. I made the callback and timeout callback Firebug logs also. > > cheers, > - ricardo > > On Jan 27, 5:01 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote: > > > Unless you remove the script tag after the 'timeout', of couse. > > > On Jan 27, 9:59 am, Mike Alsup <mal...@gmail.com> wrote: > > > > > ah .... and there is no way to simulate that? > > > > You can simulate a timeout in your code by using setTimeout, but it's > > > not the same as when the XHR is used for the request. With XHR jQuery > > > can invoke the abort fn to cancel the request. There is no such > > > option for the jsonp script injection method. So you can not close > > > the connection or do anything particularly useful other than assume > > > your timeout is being called because the request failed. But then > > > you're only guessing, and the response may return the moment after you > > > time it out.