javascript - Prevent jQuery Waypoints firing twice or multiple times -


i trying develop infinite scroll waypoints , php mysql ajax call, each time trigger comes view, strangely fires twice, same db results appended twice, though refresh waypoints after ajax call made.

the trigger button gets pushed down more items being appended above it, waypoint should pushed down already, does, keeps firing twice each time.

how can prevent this?

<div id="items-holder"></div> <a href="#" id="load-more">load more</a>  <script> var waypoint = new waypoint({ element: document.getelementbyid('load-more'), offset: 'bottom-in-view', handler: function() { $.get('load-more-items.php', function(data) { $('#items-holder').append(data); if (data != ''){ waypoint.refreshall(); } // end if has data }); // end ajax function }, }) </script> 


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -