Issue:
I am calling a function on scroll in my code:
$(window).bind('scroll',function (){
loading();
});
Here loading() is sending an Ajax request to load the pages, now I want to stop the call to this function when my total_pages count is equal to current_page or else it is sends too many Ajax requests.
Question:
How do I stop the call to this function in Jquery?
You can use the unbind method to remove the
scrollhandler fromwindow. Try:It should do the trick