您的位置:首页 > Web前端 > JQuery

jquery滚动条加载数据

2016-04-23 21:40 489 查看
//滚动条
$(window).scroll(function () {
var scrollTop = $(this).scrollTop();
var scrollHeight = $(document).height();
var windowHeight = $(this).height();
var data = $("#n").text();
console.log(data);
if (scrollTop + windowHeight == scrollHeight) {
//此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作
$.ajax({
url: basePath+'/daily/toDailyDebtNextPage.shtml',
type: 'GET',
dataType: "json",
//timeout: 15000,
cache:false,
data:data,
beforeSend: function (e){

},
success: function(data, status){
var html = '';
var list = data.debtList;

for (var i = list.length - 1; i >= 0; i--) {

html += '<div class="list_box"><div class="con"><table><tr><td>标的类型</td><td class="r m">'+list[i].debType+'</td></tr><tr><td>借款人身份证号</td><td class="r no'+data.maxId+'">'+list[i].debtorIdentityNo+'</td></tr><tr><td>借款用途</td><td class="r">'+list[i].debtPurpose+'</td></tr><tr><td>借款金额(元)</td><td class="f_yellow r">'+list[i].loanReceiptAmt+'</td></tr></table></div></div>';
};

$('#list').append(html);
geshi(data.maxId);

console.log(data);
var maxRecords = parseInt(data.maxRecords);
//var startId = 0;
var startId = parseInt(data.maxId)+1;
var userId = parseInt(data.userId);
var prodNo = data.prodNo;
var data ="userId="+userId+"&prodNo="+prodNo+"&startId="+startId+ "&maxRecords="+maxRecords;
if(list.length<maxRecords)
{$('#m').html("加载完毕..")};
$('#n').text(data);
},
error: function(XMLHttpRequest,event,ajaxOptions, thrownError){

}
});
}
});

jquery读取jsonp数据代码

HTML状态码大全(301,404,500等)

html,shtml和htm的区别

原文地址:http://www.35ui.cn/post/20160311921.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: