foreach($models as model){
$str .= model['name'];
}
which is not returning even rows, but a single string from all the names. And also this model in the foreach won't work without $. And next, just return the paginator and it will have the links inside, no need to do $models->links() in the controller. So your AJAX returns 500 I guess because of other errors, it is not even getting to the response.
@Snapey Sir! I can see many methods here but I actually need to return html of links created according data how can do that it will really help me if you could send a code sir!
@Snapey i have tried all methods from link. but it's not working at all I got all raws and data perfectly but not getting pagination link html. i am getting (Object { }) when i try to return $models->links().
@folium I was looking for this all over... Not able to find the solution for this on the Laravel Documentation on Laravel's official documentation on Pagination made wanna utter bad words... And I've been doing it for 5 hours until I found you. :)