ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### ajax 分页 先在HTML 页面 引用 分页 页面 ` {include file="admin/pageCommon"/}` 通过AJAX 跳到 页面要调取数据的方法获取数据 例如: ~~~ $.ajax({ type : "post", url : "ADMIN_MAIN/Member/memberList", async : true, data : { "page_index" : page_index, "page_size" : page_size,            "search_text" : search_text,"tel":tel,"email":email }, success : function(data) {          //处理数据          //由于示例代码较多,这里简化写一下 var html = ''; if (data["data"].length > 0) {       //这里进行数据拼接  if (data["data"][i]["nick_name"] != null ) { html += '昵称 : '+data["data"][i]["nick_name"] ; } }else { html += '暂无符合条件的数据记录'; } $(".style0list tbody").html(html); initPageData(data["page_count"],data['data'].length,data['total_count']); $("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow})); } ~~~ 控制器中的方法 ~~~ public function memberList() { if (request()->isAjax()) { $page_index = request()->post("page_index",1); $page_size = request()->post('page_size',PAGESIZE); $search_text = isset($_POST['search_text']) ? $_POST['search_text'] : ''; $tel = isset($_POST['tel']) ? $_POST['tel'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $member = new MemberService(); $list = $member->getMemberList($page_index, $page_size, [ 'is_member' => 1, 'nick_name' => array( 'like', '%' . $search_text . '%' ), 'user_tel' => array( 'like', '%' . $tel . '%' ), 'user_email' => array( 'like', '%' . $email . '%' ) ], 'reg_time desc'); return $list; } else { //查询会员等级 $member = new MemberService(); $list = $member->getMemberLevelList(1,0); $this->assign('level_list',$list); return view($this->style . 'Member/memberList'); } } ~~~ //service层 ~~~ /** * 会员列表 * * @param number $page_index * @param number $page_size * @param string $condition * @param string $order * @param string $field */ public function getMemberList($page_index = 1, $page_size = 0, $condition = '', $order = '', $field = '*') { $user = new UserModel(); $result = $user->pageQuery($page_index, $page_size, $condition, $order, $field); return $result; } ~~~