首先创建一个分页的类:int 当前页数 int 总页数 object 页面数据 在api界面创建一个常量,显示几页,public const int PAGECOUNT=3; 用一个list<>接收所有查询的数据。list<cmodel> list=bll.get(); 实例化一个分页的类,page pa=new page(); 分页的当前页=方法的参数代表当前页; 分页的总页数=list.count/PAGECOUNT+(list.count%PAGECOUNT==0?0:1); 将数据绑定到分页的数据上=list.skip((page-1)*PAGECOUNT).TaKe(PAGECOUNT); 显示界面的:url:"?page="+currentpage $("#table").empty(); success:function(data){ currentpage=data.currentpage;totalpage=data.totalpage; $(data.Data).each(function(){ 数据展示}) <a href"#">标签:首页,尾页,上一页,下一页 建立四个方法,分别调用: 把总数据建立一个方法showdata() 建立两个变量:var currentpage=1//当前多少页;var totalpage=0;//总页数 function frist() { currentpage=1; getdata(); } function lastpage() { currentpage=totalpage; getdata(); } funtion shangpage() { if(currentpage-1<=0) { alert("已经是第一页了"); return; } currentpage--; showdata(); } funtion xiapage() { if(currentpage+1>totalpage) { alert("已经是最后一页了"); return; } currentpage++; showdata(); }