Opened 13 years ago
Closed 12 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 13 years ago by
comment:3 Changed 12 years ago by
Priority: | → undecided |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
Duplicate of #6060.
Note: See
TracTickets for help on using
tickets.
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!