日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

layui 分页ajax,实现Ajax异步的layui分页

發布時間:2025/3/8 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 layui 分页ajax,实现Ajax异步的layui分页 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

頁面代碼:

人才推薦

姓名學歷技能經驗住址聯系方式

${res}${data}于千萬年之中時間的無涯的荒野里…時間的無涯的荒野里…

--%>

js代碼

//加載完成

$(function(){

var sherchkey='${positioninfo.name}';

savePosition();//保存修改方法

getPeopleList(1,5,sherchkey);//獲取人才列表

// getPageList(); //分頁方法

});

//自己封裝獲取數據方法

function getPeopleList(crr,lmt,searchKey){

//獲取人才列表

$.ajax({

url:'${ctx}/recruit/peoplelist',

type:'post',

data:{

"curr":crr||1,

"pageSize":lmt||5,

"searchKey":searchKey

},

dataType:'json',

success:function(res){

if(res.success=="success"){

console.log(res);

count=res.data.totalElements;//總記錄

curr=res.data.number; //當前頁

limit=res.data.size; //每頁幾個

var rclist=res.data.content;

var html='';

var len=rclist.length;

for (var i=0; i

var htmlbuf='

'+

'

'+rclist[i].name+''+

'

'+rclist[i].edu+''+

'

'+rclist[i].skill+''+

'

'+rclist[i].exp+''+

'

'+rclist[i].add+''+

'

'+rclist[i].tel+''+

'

';

html=html+htmlbuf;

}

$("#rcktb").html(html);

//調用分頁方法

getPageList(count,curr,limit,searchKey);

}else {

layer.alert(res.message);

}

},

error:function(){

layer.msg("網絡故障");

}

})

}

//自己封裝分頁方法

function getPageList(count,curr,limit,searchKey){

//分頁方法

layui.use(['laypage', 'layer'], function(){

var laypage = layui.laypage

,layer = layui.layer;

//完整功能

laypage.render({

elem: 'pagefenye',

count: count||0,

theme: '#009587',

limit : limit||3,

limits:[5, 10, 20, 30, 40],

curr : curr||1,

layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip'],

jump: function(obj,first){

//debugger;

if(!first){

//window.location.href = "?curr="+obj.curr+"&pageSize="+obj.limit+"&enterId="+'${enterId}';

getPeopleList (obj.curr,obj.limit,searchKey);

}

}

});

});

}

后臺代碼

/**

*

* @param curr

* @param pageSize

* @param searchKey

* @param enterId

* @param model

* @return

*/

@RequestMapping("/peoplelist")

@ResponseBody

public ResultEntity peopleList(@RequestParam(value = "curr", defaultValue = "1") int curr,

@RequestParam(value = "pageSize", defaultValue = "5") int pageSize,String searchKey,Model model){

ResultEntity res = new ResultEntity();

try {

PageUtils pageUtils = new PageUtils(curr, pageSize, "", "");

Page>> list = recruitService.getPeopleList(searchKey, pageUtils);

List> dataList = (List>) list.getData();

PageVo pageVo = new PageVo(list.getCurrentPageNo() - 1, dataList, pageSize, list.getTotalPageCount(),

list.getTotalCount());

pageVo.setNumber(curr);

res.setData(pageVo);

//res.setData(curr);

//res.setData(enterId);

res.setSuccess("success");

res.setMessage("獲取成功");

} catch (Exception e) {

e.printStackTrace();

res.setSuccess("false");

res.setMessage("獲取失敗");

}

return res;

}

總結

以上是生活随笔為你收集整理的layui 分页ajax,实现Ajax异步的layui分页的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。