jquery分页插件pagination使用教程

2020-05-19 07:28:05易采站长站整理

"</a></label></div><div class="content">" + articContent + "</div>" +
"<div class="show_last"><div class='img_delete'><img class='img_delete' alt="删除" title="删除" src="image/lajixiang_03.png" href="#" onclick="deleteArticle(" + json.data.list[i].id + ");"/></div>" +
"<div><label>发布于:</label><label class="blue">" + create_Time + "</label></div></div></div>";
$("#list_container").append(articObj);
// alert(userIdid)
var gotoId = "goto" + json.data.list[i].id;
if (userIdid == "userId") { //收藏的文章
document.getElementById(gotoId).href = "ArticleDetail.html?id=" + json.data.list[i].id;
$(".img_delete").css("display", "none");
} else if (userIdid == "aid") { //我的文章
$(".img_delete").css("display", "block");
document.getElementById(gotoId).href = "editArticle.html?id=" + json.data.list[i].id;
}
}
pageObj = '<span class="page-sum">共<strong class="allPage">' + json.data.totalPage + '</strong>页</span>';
$("#searchPage").append(pageObj);
$("#Pagination").pagination(json.data.count, {
items_per_page: 5, //pageSize每页最多显示多少条
callback: pageselectCallback
});
}
reSetIframeHeight();
} else if (json.code == 0) {}
}
});
}
window.onload = function() {
getMyArtic();
personalityCenterRefresh();
}
function pageselectCallback(page_index) {
var createTime = document.getElementById("searchTime").value;
if (createTime.length == 0 || createTime == null) {
createTime = myDate.toLocaleDateString();
}
if (userIdid == "aid") {
data["aid"] = aid;
} else {
data["userId"] = aid;
}
data["pageNow"] = parseInt(page_index) + 1;
jQuery.support.cors = true;
$.ajax({
url: serverAddress,
xhrFields: {
withCredentials: true
},
crossDomain: true,
async: true,
cache: false,
type: "post",
dataType: "json",
data: data,
success: function(json) {
$("#list_container").empty();
if (json.code == 1) {
if (json.data.recordCount > 0) {
sessionStorage.setItem("artic", JSON.stringify(json.data));
for (var i = 0; i < json.data.recordCount; i++) {
articContent = json.data.list[i].content;
//alert(articContent);
var regEx = /<[^>]*>/g;
articContent = articContent.replace(regEx, "");
if (articContent.length > 100) {
articContent = articContent.substring(0, 100) + "...";
}
var create_Time = json.data.list[i].createTime;
if (create_Time != null || create_Time != "") {
create_Time = create_Time.substring(0, 19);
}
articObj = "<div class="list"><div class="title_list"><label class="pre blue"><a class="pre blue" href="#" onclick="javascript:location.href='editArticle.html?id=" + json.data.list[i].id + "'">" + json.data.list[i].title +