I am creating a 'scroll to bottom' news feed that populates news when the user scrolls to the bottom of the page.
I have the following code (via Check if a user has scrolled to the bottom):
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
//Ajax Request
}
});
How can I make sure that a user does not scroll up and then scroll down again before the ajax request is done to populate the news. In other words whats a clean way to pause it until the ajax request is done and has filled in its results