Skip to main content

Bug Tracker

Side navigation

#6678 closed bug (duplicate)

Opened June 16, 2010 09:52AM UTC

Closed October 09, 2010 04:08AM UTC

AJAX timeout error

Reported by: rallu Owned by:
Priority: undecided Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: ajax timeout Cc:
Blocked by: Blocking:
Description

When ajax call makes timeout error it first loads error function and after that it loads success function right after error.

In success method data is empty string and xmlhttprequest.status is 0.

Attachments (0)
Change History (3)

Changed June 18, 2010 08:38AM UTC by alexs comment:1

Hi,

It seems error callback function doesn't work properly. Since 1.4.2 jQuery doesn't call error callback in case of timeout. It always executes "success" callback with status 0. I tried to turn off timeout, set it to 10s. In the end I was wondered when I passed 10ms the error callback function fired. My application supports offline mode and I need to know when the request failed so I can suppose that user if offline.

I use the following code:

#!php
var opt = {
    contentType: 'application/x-www-form-urlencoded',
    async:       true,
    global:      false,
    cache:       false,
    //dataType:    'json',
    ifModified:  false,
    type:        'POST',
    url:         "?m=synch&a=write",
    timeout:     10*1000,
    error:       function(xhr) { console.log("error", arguments); },
    success:     function() { console.log("success", arguments); }
};

jQuery.ajax(opt);

Thanks!

Changed October 07, 2010 03:52PM UTC by curiousdannii comment:2

Probably fixed when #6060 was fixed.

Changed October 09, 2010 04:08AM UTC by snover comment:3

priority: → undecided
resolution: → duplicate
status: newclosed

Duplicate of #6060.