怎么获得当前点击的页码,实现更新currentPage.给页码绑定单击事件绑不上,求解答
怎么不支持IE8想哭
您好 请问 点击分页前三页都正常跳转显示 但是第四页往后 就会页码全部变为负数 请问这个是什么问题
function listShow() {
$.ajax({
url: '/luntan/list_luntan.php',
data: {
'category_id': 1,
'page': 1
},
success: function (res) {
console.log(JSON.parse(res))
var data = JSON.parse(res)
var html = template('tt', data)
$('#c_tbody').html(html)
//分页
var pageAll = data.page.total_pages
var currpage = data.page.now_page
$("#pagination1").pagination({
currentPage: currpage, //第几页
totalPage: pageAll,//总页数
count: 7, //页码个数
callback: function (current) {//回调 current 点击按钮的值
alert(current)
$.post('/luntan/list_luntan.php', {
'category_id': 1,
'page': current
}, function (res1) {
var data1 = JSON.parse(res1)
console.log(data1)
console.log(res1)
pageAll = data1.page.total_pages,//总页数
pageNow = data1.page.now_page;//第几页
$("#pagination1").pagination("setPage", pageNow, pageAll);//从新设置分页
var html = template('tt', data1)
$('#c_tbody').html(html)
})
}
});
}
})
}
回复
$(...).pagination is not a function这是为啥,该导入的js都导入了,版本也一样
楼主可不可以在源码了添加一个跳转页码的功能啊,这个工作量应该不大把;我现在只能用本办法,写一个单独的css样式来放到你的代码后边,点击跳转触发setpage这个方法设置,