Bug Tracker

Opened 7 years ago

Closed 7 years ago

#14618 closed bug (notabug)

ajax fails when page navigate away

Reported by: hiwayche@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

if ajax takes a little longer time, during ajax call, if user click another hyper-link to navigate away, the ajax 'fail handler' will be called. As the code below, if page navigate away before ajax call completes, the fail handler will be called.

function timeConsumingTest(){

$.post('XXX', function(data, status, xhr){

alert(data);

}).fail(function(xhr, status, thrown){

alert("error occured");

});

}

I think it is a bug, and how to sovle it? this bug can be reappeared both in chrome and firefox.

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

If you do an asynchronous request that is the way the XHR object works.

http://stackoverflow.com/questions/3584288/can-the-unload-event-be-used-to-reliably-fire-ajax-request

Note: See TracTickets for help on using tickets.