Canceled AJAX request slows down subsequent navigation

In my application, when a user requests a report, a jQuery AJAX call is made (using .load()) to a file that executes a lot of crunch requests and the number of mySQL queries. it usually takes 5-6 seconds to load, and .ajaxStart()they .ajaxStop()are used to display the boot gif at boot time.

Problem:

If the user clicks the "generate report" button, and then changes his mind and tries to go to another page that is hanging by the application, and does not go to a new page within 5-6 seconds. I can tell from the removal of the gif download that .ajaxStop()fires immediately when I try to go to a new page, but it seems that the ajax request ends before the browser loads the next page.

Is this normal behavior? Any suggestions for fixing / restructuring this?

+5
source share
1 answer

, .ajaxStop() ajax, beforeSend false. , . , . .ajaxStop() , ajax , , , .

ajaxStop , Ajax , false beforeSend.

jquery api . ajaxStop(). , , , , . , , .

, .

0

All Articles