jQuery.ajax checking if there is already another xhr
- by digitalFresh
I have a page when, if the user is near the bottom of the page, loads the next page.
I just recently switched it to jQuery, and now use the jQuery.ajax() function to get the data. However, now i cannot check if the xhr is already loading, making the page load multiple xhrs when the user near the bottom.
My listener is:
$(document).scroll(function () {
if(/* scrollbar is near bottom */)
loadxhr(dat++); //function that calls jQuery.ajax()
}
});
Basically, can you track the readyState of the call in a global scope?