laravel|php laravel+jq实现滚动到底部进行数据加载,延时加载,懒加载

前端完成请求数据的获取,和记录在成功接收数据后,记录下一次下拉的序号:如第一次默认是第二页,将2和筛选条件传到后台进行处理,返回数据成功,更改序号为3,下一次下拉传后台为3

var tab1id=2//开始第二页 全局变量自增,在请求后加一传到后台作为limit限制条件 var tab2id=2//开始第二页 var tab3id=2//开始第二页//滚动条到达底部请求下一页 $(window).scroll(function () { var sid =$('.tabswitch').children('.active').attr('id')//区别分类if ($(document).scrollTop() >= $(document).height() - $(window).height()) {switch (sid) { case 'tabcode'://apend错误码 $.ajax({ type:'post', url:'/hwtc/terminal/codeapend', data:{tab1id:tab1id,hwid:hwid,d1:d1,d2:d2,code:code}, success:function (e) { tab1id+=1 if (e.data.length > 0) { for (var i = 0; i < e.data.length; i++) { $('#wrongcode').append(" \n" + ""+e.data[i].id+"\n" + ""+e.data[i].code+"\n" + ""+e.data[i].ngat+"\n" + ""+e.data[i].client_time+"\n" + ""+e.data[i].server_time+"\n" + "") }} } }) break; case 'tabbp': $.ajax({ type:'post', url:'/hwtc/terminal/bpapend', data:{tab2id:tab2id,hwid:hwid,d1:d1,d2:d2}, success:function (e) { tab2id+=1 if (e.data.length > 0) { for (var i = 0; i < e.data.length; i++) { $('#wrongbp').append("\n" + ""+e.data[i].id+"\n" + ""+e.data[i].voltage+"\n" + "-\n" + ""+e.data[i].charge+"\n" + ""+e.data[i].valid+"\n" + ""+e.data[i].client_time+"\n" + ""+e.data[i].server_time+"\n" + "") }} } }); break; case 'tabacc': var vin = $("#accvinselect").val() var acctype =$("#acctypeselect").val() $.ajax({ type:'post', url:'/hwtc/terminal/accapend', data:{tab3id:tab3id,hwid:hwid,d1:d1,d2:d2,vin:vin,acctype:acctype}, success:function (e) { tab3id+=1 if (e.data.length > 0) { for (var i = 0; i < e.data.length; i++) { $('#wrongacc').append(" \n" + ""+e.data[i].id+"\n" + ""+e.data[i].equipment.vin+"\n" + ""+e.data[i].connect_time+"\n" + ""+e.data[i].disconnect_time+"\n" + ""+e.data[i].disconnect_type+"\n" + "") }} } }); break; }console.log(sid) console.log(tab3id) // console.log($('#accvinselect').val()) // console.log($('#acctypeselect').val()) } })

【laravel|php laravel+jq实现滚动到底部进行数据加载,延时加载,懒加载】后台处理
$tabid = ($request->tab3id)-1; $page = config('hwtc.page_size')*$tabid; $access =Logaccess::where($whereacc)->offset($page)->limit(config('hwtc.page_size'))->get(); //登录

    推荐阅读