tp5ajax分页

1.首页在控制也获取分页参数

$p = input("p/d",'0');
$list = db('Comment')->paginate(config('paginate.list_rows'),$count,['page'=>$p,'path'=>"javascript:void(0);"]);
$this->assign('commentlist',$list);// 商品评论
return $this->fetch();

<div class='dataTables_paginate paging_simple_numbers'>
{$commentlist->render()}
</div>

js

// 点击分页触发的事件
$("#ajax_comment_return .pagination a").click(function(){
ajaxComment($(this).html());//获取当前页数
});

/***用ajax分页显示**/
function ajaxComment(page){
$.ajax({
type : "GET",
url:"/Index/Goods/ajaxComment?p="+page,//+tab,
success: function(data){
$("#ajax_comment_return").html('').append(data);
}
});
}

猜你喜欢

转载自www.cnblogs.com/phpzlq/p/9723401.html
今日推荐