Answer the question
In order to leave comments, you need to log in
How to pass pagination to ajax?
How to send pagination to ajax request?
A simple ajax pass example:
$posts=Post::where('category_id', $category)->paginate(10);
$html = view('main', compact('posts'))->render();
return response()->json(['html' => $html]);
$posts=Post::where('category_id', $category)->paginate(10);
$html = view('main', compact('posts'))->render();
$paginate = $posts->links();
return response()->json(['html' => $html, 'paginate' => $paginate]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question