Bug Tracker

Opened 9 years ago

Closed 9 years ago

#6678 closed bug (duplicate)

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.

Change History (3)

comment:1 Changed 9 years ago by alexs

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:

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!

comment:2 Changed 9 years ago by curiousdannii

Probably fixed when #6060 was fixed.

comment:3 Changed 9 years ago by snover

Priority: undecided
Resolution: duplicate
Status: newclosed

Duplicate of #6060.

Note: See TracTickets for help on using tickets.