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);
}
});
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM