I tried that without the if (see code above) and the error isn't
thrown.
I also used a Jquery JSONP library, and there the error is thrown
(immediately) when the user is offline.
I'm trying to get that same behavior. Adding my own timeout has as
disadvantage that I'd have to wait for that, while the error should
happen immediately when the user is offline.
Any idea's are welcome.
Thanks!
PanMan.

On Apr 20, 4:02 pm, "Mauricio \(Maujor\) Samy Silva"
<css.mau...@gmail.com> wrote:
> >A timeout is not considered an error.
>
> No. It's an error.
>
> Do the following:
>
> "timeout": 10000,
>     "error": function(d,msg) {
>
>     if (msg=="timeout") {
>     alert("Ops! Could not load stuff - A timedout error occur");
>     } else {      
>     alert("Could not load stuff  - Another errorType occur");
>     },
> ...
>
> Maurício
>   -----Mensagem Original-----
>   De: Martijn Houtman
>   Para: jquery-en@googlegroups.com
>   Enviada em: segunda-feira, 20 de abril de 2009 10:47
>   Assunto: [jQuery] Re: Ajax timeout doesn't call error function?
>
>   Hey PanMan,
>
>   On Apr 20, 2009, at 12:28 PM, PanMan wrote:
>
>     This works, but the error is never thrown. If I change the URL to
>
>     something that's broken, I do get the error message, but on timeout it
>
>     never happens.
>
>     Am I doing anything wrong? Or is this a bug somewhere?
>
>   No, this is not a bug. A timeout is not considered an error. You'd be 
> better off using manual timeouts or use some sort of ajax manager.
>
>   For my setup I used a combination of both, in which I set a timer with a 
> certain value for connection timeout, and clear that timer when I actually 
> receive data. The timer calls an anonymous function which aborts the ajax 
> request (and in my case, calls the request again). This works fine for me.
>
>   Regards,
>   --
>   Martijn.

Reply via email to