title: How to end JQuery endless scroll
body: <p>I know this topic is overflowing on this site however when using the endless scroll plugin below I was hoping to figure out a way of just loading from my ajax request but somehow just ending at some point. e.g. eventually reaching the bottom? Any help is much appreciated?</p>
  
  <pre><code>     &lt;script type="text/javascript"&gt;
  $(window).scroll(function()
  {
      if($(window).scrollTop() == $(document).height() - $(window).height())
  {
      $('div#loadmoreajaxloader').show();
      $.ajax({
      url: "{{url('contentpage')}}",
      success: function(html)
      {
          if(html)
          {
              $("#postswrapper").append(html);
              $('div#loadmoreajaxloader').hide();
          }else
          {
              $('div#loadmoreajaxloader').html('&lt;center&gt;No more posts to show.&lt;/center&gt;');
          }
      }
      });
      }
  });
  &lt;/script&gt;
  </code></pre>