>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