Jquery Laravel Ajax分页
我正在尝试基于复选框单击为ajax搜索过滤器进行分页。每个复选框上的“我的控制器”功能单击:Jquery Laravel Ajax分页,jquery,ajax,laravel-4,pagination,Jquery,Ajax,Laravel 4,Pagination,我正在尝试基于复选框单击为ajax搜索过滤器进行分页。每个复选框上的“我的控制器”功能单击: public function ajaxGetServices(){ $a_data = Input::all(); Session::put('a_data',$a_data); $i=0; if(count($a_data) == 0){ $temp = User::has('editor')->paginate(4); $
public function ajaxGetServices(){
$a_data = Input::all();
Session::put('a_data',$a_data);
$i=0;
if(count($a_data) == 0){
$temp = User::has('editor')->paginate(4);
$this->data['editors'] = $temp->toArray();
if(Auth::user()){
$this->data['favorited_editors'] = Favorite::where('member_id','=',Auth::user()->id)->get()->toArray();
$i=1;
}
}else{
$editors = User::with(['editor.credentials','editor.specialties','editor.ratings']);
$temp=$editors->whereHas('editor', function($q) use ($a_data){
$q->whereHas('specialties',function($sq) use($a_data){
$sq->whereIn('specialty',$a_data);
});
})->paginate(2);
//var_dump($temp->toJson()); die();
$this->data['editors'] = $temp->toArray();
if(Auth::user()){
$this->data['favorited_editors'] = Favorite::where('member_id','=',Auth::user()->id)->get()->toArray();
$i=1;
}
}//endelse
if($i==1){
return Response::json(array('editors' => $this->data['editors'], 'favorited_editors' => $this->data['favorited_editors']));
}
else{
$this->data['favorited_editors'] = array();
return Response::json(array('editors' => $this->data['editors'], 'favorited_editors' => $this->data['favorited_editors']));
}
}
这为我提供了分页的总页数、当前页、每页、起始和结束字段。现在我需要重新生成分页链接,以反映上述结果。请指导我如何着手做这件事。此外,如果需要,我可以提供更多的代码来澄清我的问题。感谢您的支持。也许这篇文章会有所帮助
(完整的示例,所以我没有提供任何解释)此外,目前我正在发送links()数据以及其他结果。在ajax成功函数中,我用“links”数据替换分页的
ul
。但是每个链接都有getServices?page=2
,但它抛出'MethodNotAllowedHttpException'`