0
(laravel 4)。如何从ajax获得分页链接?
在我看来,我有:
$posts->links();
显示帖子分页和工作正常, 然后我决定与Ajax的工作原理搜索字段。 问题是,当我搜索某些东西时,我也需要更改分页。 (新的结果分页)。
我想对我的PostsAjax功能是这样的:
$posts=Post::where(...)->paginate(9);
foreach($posts as $post){
$results.='<li>..</li>';
}
$data=array('results'=>$results, 'pagination'=>$posts->links());
return Response::json($data);
但data.pagination其空的Ajax响应。