Jquery+JSon 无刷新分页实现代码

2020-05-23 06:00:39易采站长站整理

}

HTML页面代码:

<form runat=”server” id=”form1″>
<div>
<asp:Repeater ID=”rptBooks” runat=”server”>
<HeaderTemplate>
<table id=”Books” width=”90%” cellspacing=”0″ style=”font-size:12px;”>
<tr>
<th>
书名
</th>
<th>
作者
</th>
<th>
类别
</th>
<th width=”30px”>
</th>
<th width=”30px”>
</th>
</tr>
<tbody id=”Data”>
<tr>
</HeaderTemplate>
<ItemTemplate>
<td class=”Title”>
<%# Eval(“Title”) %>
</td>
<td class=”Author”>
<%# Eval(“Author”) %>
</td>
<td class=”CategoryName”>
<%# Eval(“Categories.Name”)%>
</td>
<td>
<a href=”#” id='<%# Eval(“Id”) %>’ class=”delBook”>删除</a>
</td>
<td>
<a href=’BookDetail/<%# Eval(“Id”) %>’ class=”details”>详细</a>
</td>
</ItemTemplate>
<SeparatorTemplate>
</tr><tr>
</SeparatorTemplate>
<FooterTemplate>
</tr></tbody>
<tr>
<td colspan=”3″>
<cc1:PageBar ID=”PageBar1″ runat=”server” PageCount=”100″ DisplayCount=”5″ PageIndex=”1″ />
<input type=”text” id = “CI” />
</td>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>

Ajax请求地址返回的JSON数据:

{“Data”:[{“Title”:”C#.NET程序设计——国外计算机科学经典教材”,”CategoryName”:”.NET”,”Author”:”布拉德利(Bradley,J.C.),米尔斯波(Millspaugh,A.C.) 著, 天宏工作室 译”,”Id”:5392},{“Title”:”C#2.0〔宝典)(附盘)”,”CategoryName”:”C C++ VC VC++”,”Author”:”张立 编著”,”Id”:5027},{“Title”:”C#2.0完全自学手册(附CD)”,”CategoryName”:”C C++ VC VC++”,”Author”:”张立 等编著”,”Id”:5081},{“Title”:”C#2005数据库编程经典教程”,”CategoryName”:”C C++ VC VC++”,”Author”:”(美)沃顿(Karli watton) 著,陈秋萍 译”,”Id”:4983},{“Title”:”C#程序设计教程——计算机基础课程系列教材”,”CategoryName”:”C C++ VC VC++”,”Author”:”郑阿奇,梁敬东 主编”,”Id”:5127},{“Title”:”C#程序员参考手册”,”CategoryName”:”C C++ VC VC++”,”Author”:”Grant Palmer 著,康博 译”,”Id”:5132},{“Title”:”C#和.NET核心技术——开发人员专业技术丛书”,”CategoryName”:”C C++ VC VC++”,”Author”:”(美)佩里(Perry,S.C.) 著,肖斌 等译”,”Id”:5104},{“Title”:”C#基础与实例教程(附CD-ROM光盘一张)”,”CategoryName”:”C C++ VC VC++”,”Author”:”郝春强 编著”,”Id”:5071},{“Title”:”C#软件项目开发全程剖析”,”CategoryName”:”C C++ VC VC++”,”Author”:”(德)侯姆,(德)克鲁格,(德)斯普达 著,薛兴涛,袁勤勇 译”,”Id”:5034},{“Title”:”C#设计模式——开发大师系列”,”CategoryName”:”C C++ VC VC++”,”Author”:”(美)麦斯科 著,颜炯 译”,”Id”:4954}],”CurrentPageIndex”:15,”PageCount”:1074}