<input type="text" name="name" id="word"/>
???<button class="sou" id="{$arr.p}">搜索</button>
<input type="hidden" name="p" id="p" value="{$arr.p}">
<tbody id="td">
$(document).on("click",".sou",function(){
???????var p=$(this).attr("id");
???????var word=$("#word").val();
$p=Request::instance()->param("p");
???????$page=empty($p)?1:$p;
???????$where=‘‘;
???????if(Request::instance()->param("word")){
???????????$where[‘name‘]=Request::instance()->param("word");
???????}
???????$count=Db::table("list")->where($where)->count();
???????$length=4;
???????$zong=ceil($count/$length);
???????$limit=($page-1)*$length;
???????$data=Db::table("list")->limit($limit,$length)->where($where)->select();
???????$arr=[‘list‘=>$data,‘last_page‘=>$zong];
???????echo json_encode($arr);
ajax搜索分页
原文地址:https://www.cnblogs.com/gwhm/p/10223660.html