< type="text/ "> $(function(){ // 每页展示条数 var page = 10; var counter = 0,pageStart = 0,pageEnd = 0; // 异步加载 $('.content').dropload({ scrollArea : window, domDown : { domClass : 'dropload-down', domRefresh : '↑上拉加载更多', domLoad : '数据请求中...', domNoData : '我也是有底线的...' }, loadDownFn : function(me){ $.ajax({ type: 'GET', url: '{U('index/api/init')}?catid={$catid}&page='+page+'&page_start='+pageStart, dataType: 'json', success: function(data){ var result = ''; counter++; pageEnd = page * counter; pageStart = pageEnd - page; var arrLen = data.length; if (arrLen > 0) { //data里数据字段有:id,catid,inputtime,updatetime,title,url,thumb,click,nickname,de ion for (var i = 0; i < arrLen; i++) { var thumb = data[i].thumb != '' ? data[i].thumb : '{STATIC_URL}images/nopic.jpg'; result += '' +''+data[i].title +''; } } else { me.lock(); // 锁定 me.noData(); // 无数据 } $('.lists').append(result); // 每次数据加载完,必须重置 me.resetload(); }, error: function(xhr, type){ // alert('Ajax error!'); // 即使加载出错,也得重置 me.resetload(); } }); } }); });
帮忙看看,谢谢