JavaScript
4
Вклад в тег
public function loadMore(Request $request)
{
$article= Article::orderBy('id', 'desc')->paginate(2);
if ($request->ajax()) {
return $article->toJson();
}
abort(404);
}
$.ajax({
type: 'GET',
url: '/article?page=' + page,
success: function (data) {
let obj = JSON.parse(data);
createArticleNode(obj);
if (obj.to === obj.total) {
$('.button_more').hide();
}
}
});