jQuery Pagination实现Ajax分页教程(jquery.pagination.js v1.2版本下载)
Ajax分页用户体验当然更好,jQuery Pagination很容易实现Ajax分页,我用的是jquery.pagination.js v1.2版本,参数说明如下:
jQuery Pagination Ajax分页教程如下:
/** by */ var items_per_page = 20; var page_index = 0; function getDataList(index){ var pageIndex = index; $.ajax({ type: "POST", url: "/information/import/get_articles", data: "uid={$account_id}&token={$account_token}&page_index="+pageIndex+'&items_per_page='+items_per_page, dataType: 'json', contentType: "application/x-www-form-urlencoded", success: function(msg){ $(".article_box_table").remove(); var html=''; $.each(msg.result,function(i,da){ html += '<ul><li><input type="checkbox" value="'+da.id+'" /></li><li><label for="cate_0" >'+da.title+'</label></li><li>'+for_php_date_to_str(da.posttime)+'</li></ul>'; }); $(".article_box_top").after(html); } }); } function pageselectCallback(page_index, jq){ getDataList(page_index); } getDataList(page_index); $("#page").pagination("{$count}", { 'items_per_page' : items_per_page, 'num_display_entries' : 10, 'num_edge_entries' : 1, 'prev_text' : "上一页", 'next_text' : "下一页", 'callback' : pageselectCallback, 'current_page' : page_index, });
效果如下:
转载请注明地址: 尊重他人劳动成果就是尊重自己!
Javascript&AjaxjQuery