ajax - How to call loadmore function(only once) on scroll down javascript function? -


i using following code trigger onloadmore funciton when user scroll down , reaches bottom of page. notice many times function called multiple times on scroll down! 1 tell me why loadmore function called more once same set of data! internet connection problem ? want loadmore called once!

     <script> var nexttagid = null;        function callloadmore() {                 $.ajax({                 type: "get",                  datatype: "jsonp",                  cache: false,                  url: "http://api.sometime.com/api.php?count=100" + ( nexttagid ? "&next_id=" + nexttagid : ""),           success: function(data) {           (var = 0; < 100; i++) {                      document.myform.outputtext.value = document.myform.outputtext.value+data.data[i].pics.standard.path+'\n' ;                      }                 }              });          }     </script> <script>         $(function() {             $(window).bind("scroll", function (){                  console.log("scroll : " + $(window).scrolltop()                      + " - " + $(window).innerheight()                      + " - " + document.body.clientheight);                 if ($(window).scrolltop() + document.body.clientheight >= $(window).innerheight()) {                             //alert('bottom!');                                 callloadmore();                  }             });         }); </script> 


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -