ajax无刷新加载更多

如题,我对网站的一个列表页进行无刷新加载更多。采用ajax请求页面然后加载到当前页下面!可是无论我怎么改都是只能加载第一页,我是汗颜了,到底错哪里了?高手帮忙看一下啊!!!!

  1.  
     
  2.  
    <!--载入更多-->
  3.  
    <div class="return-top tianstion" title="返回顶部" id="returnTop"></div>
  4.  
    <em class="wrap line">line</em>
  5.  
    <span class="bottomMore wrap" onClick="loadMore();">载入更多....</span>
  6.  
    <input type="hidden" value="2" id="pages">
  7.  
     
  8.  
     
  9.  
    </body>
  10.  
    </html>
  11.  
    <script>
  12.  
    var staus = 0;
  13.  
    function loadMore(){
  14.  
    status = 1;
  15.  
    var tid = '15';
  16.  
    var TotalResult = '500';
  17.  
    var pageNo = $('#pages').val();
  18.  
    $.ajax({
  19.  
    type: "POST",
  20.  
    url: "/plus/list.php?&tid="+tid+"&TotalResult="+TotalResult+"&pageNo="+pageNo,
  21.  
    data: "name=John&location=Boston",
  22.  
    success: function(msg){
  23.  
    $('#pages').val(parseInt(pageNo)+1);
  24.  
    $('#ul').append(msg);
  25.  
    }
  26.  
    });
  27.  
    }
  28.  
     
  29.  
    window.onscroll = function(){
  30.  
    var t = document.documentElement.scrollTop || document.body.scrollTop;
  31.  
    if( ( $(window).height() + $(window).scrollTop() ) >= ( $("body").height()*0.9 )){
  32.  
    if(status == 0)
  33.  
    loadMore();
  34.  
    }
  35.  
    }
  36.  
    </script>
  37.  
 
 
posted @ 2022-08-20 20:44  ingemar,fang  阅读(42)  评论(0编辑  收藏  举报