Skip to main content

Bug Tracker

Side navigation

#14618 closed bug (notabug)

Opened December 08, 2013 10:19AM UTC

Closed December 08, 2013 02:23PM UTC

ajax fails when page navigate away

Reported by: hiwayche@gmail.com 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.

Attachments (0)
Change History (1)

Changed December 08, 2013 02:23PM UTC by dmethvin comment:1

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