jQuery 無刷新分頁實(shí)例代碼
<html>
<head>
<script type="text/javascript" src="script/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="script/jquery-1.7.1.js"></script>
<script type="text/javascript" src="script/jquery.pagination.js"></script>
<script type="text/javascript">
$(function(){
//此demo通過Ajax加載分頁元素
var initPagination = function(data) {
var feedback = "";
$.each(data.list, function(index, d) {
var str ="";
str+= "<dl class='result' style='display:none;'>";
str+="<dt><img src='http://www.dbjr.com.cn/headshotsByName/balijiang.png?l' alt='圖片' width='70' height='70' /></dt>";
str+="<dd><a href='#' title='VYyu'>VYyu</a></dd>";
str+="<dd class='gray'>2009-09-26 </dd>";
str+="<dd>"+d+"</dd>";
str+="</dl>";
feedback += str;
});
$("#feedback").empty().append(feedback); //裝載對應(yīng)分頁的內(nèi)容
//alert(datac.list.length);
//var num_entries = $(".result").length;
var num_entries = data.list.length;
// 創(chuàng)建分頁
$("#page").pagination(num_entries, {
num_edge_entries: 1, //邊緣頁數(shù)
num_display_entries: 5, //主體頁數(shù)
callback: pageselectCallback,
items_per_page: 3, //每頁顯示1項(xiàng)
prev_text: "前一頁",
next_text: "后一頁"
});
pageselectCallback(0);
}
function pageselectCallback(page_index, jq){
var resultList = $(".result");
//var feedback = "";
//alert(resultList.length);
$(".result").each( function(index, data) {
//alert(index);
$(this).css('display','none');
if(Math.floor(index/3) == page_index){
$(this).css('display','block');
}
});
return false;
}
//ajax加載
$.getJSON("testPage",null, function(data){initPagination(data)});
});
</script>
</head>
<body>
<div id="feedback" class="feedback"> </div>
<div id="page" class="pager"></div>
</body>
</html>
- jquery插件pagination實(shí)現(xiàn)無刷新ajax分頁
- jQuery插件jPaginate實(shí)現(xiàn)無刷新分頁
- JQuery+Ajax無刷新分頁的實(shí)例代碼
- JQuery與JSon實(shí)現(xiàn)的無刷新分頁代碼
- 基于jquery的無刷新分頁技術(shù)
- jquery+ashx無刷新GridView數(shù)據(jù)顯示插件(實(shí)現(xiàn)分頁、排序、過濾功能)
- Jquery+JSon 無刷新分頁實(shí)現(xiàn)代碼
- php jquery 實(shí)現(xiàn)新聞標(biāo)簽分類與無刷新分頁
- jquery pagination插件實(shí)現(xiàn)無刷新分頁代碼
- jQuery無刷新分頁完整實(shí)例代碼
相關(guān)文章
jQuery中ajax獲取數(shù)據(jù)賦值給頁面的實(shí)例
下面小編就為大家分享一篇jQuery中ajax獲取數(shù)據(jù)賦值給頁面的實(shí)例,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2017-12-12jQuery+ajax實(shí)現(xiàn)用戶登錄驗(yàn)證
這篇文章主要為大家詳細(xì)介紹了jQuery+ajax實(shí)現(xiàn)用戶登錄驗(yàn)證,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-09-09jquery ui dialog替代confirm實(shí)例分析
這篇文章主要介紹了jquery ui dialog替代confirm的實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了jQuery ui插件的dialog模擬confirm功能的具體步驟與實(shí)現(xiàn)技巧,需要的朋友可以參考下2016-01-01jQuery ajax MD5實(shí)現(xiàn)用戶注冊即時(shí)驗(yàn)證功能
這篇文章主要為大家詳細(xì)介紹了JQuery AJAX MD5實(shí)現(xiàn)用戶注冊即時(shí)驗(yàn)證功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-10-10詳解JavaScript中jQuery和Ajax以及JSONP的聯(lián)合使用
這篇文章主要介紹了詳解JavaScript中jQuery和Ajax以及JSONP的聯(lián)合使用,jQuery庫和Ajax異步結(jié)構(gòu)以及JSON數(shù)據(jù)傳輸也是JS日常編程中最常用到的東西,需要的朋友可以參考下2015-08-08