https://bbs.csdn.net/topics/390980134如题,我对网站的一个列表页进行无刷新加载更多。采用ajax请求页面然后加载到当前页下面!可是无论我怎么改都是只能加载第一页,我是汗颜了,到底错哪里了?高手帮忙看一下啊!!!!
-
<!--载入更多-->
-
<div class="return-top tianstion" title="返回顶部" id="returnTop"></div>
-
<em class="wrap line">line</em>
-
<span class="bottomMore wrap" onClick="loadMore();">载入更多....</span>
-
<input type="hidden" value="2" id="pages">
-
</body>
-
</html>
-
<script>
-
var staus = 0;
-
function loadMore(){
-
status = 1;
-
var tid = '15';
-
var TotalResult = '500';
-
var pageNo = $('#pages').val();
- $.ajax({
-
type: "POST",
-
url: "/plus/list.php?&tid="+tid+"&TotalResult="+TotalResult+"&pageNo="+pageNo,
-
data: "name=John&location=Boston",
-
success: function(msg){
-
$('#pages').val(parseInt(pageNo)+1);
-
$('#ul').append(msg);
- }
- });
- }
-
window.onscroll = function(){
-
var t = document.documentElement.scrollTop || document.body.scrollTop;
-
if( ( $(window).height() + $(window).scrollTop() ) >= ( $("body").height()*0.9 )){
-
if(status == 0)
- loadMore();
- }
- }
-
</script>