页面下拉加载更多数据(spring MVC)

阅读更多
var SEE_MORE={p:1,loading:false,hasData:true};
//下拉到底 js 判断
    $(window).scroll(function () {
		   loadData();
	});
	function loadData() {
	    totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
	    if ($(document).height() <= totalheight +300) {
	        //下啦加载时运行
	        loadmore();
	            
	    }
	}

	<%//加载更多 %>
	function loadmore(){
		if(!SEE_MORE.loading&&SEE_MORE.hasData){
			SEE_MORE.loading = true;
			var path='${ctx}/liveClass/listMore';
			$.post(path+'?size=6&pageNum='+SEE_MORE.p,function(data){
				if($.trim(data)!=''){
					$('#courseContainer').append(data);
					
					SEE_MORE.p++;
				}
				SEE_MORE.loading = false;
			},'html');
		}
	};

 




    <%@include file="live_list_more.jsp"%>

 live_list_more.jsp 和正常jsp一样  获取后台绑定的参数就行

你可能感兴趣的:(页面下拉加载更多数据(spring MVC))