1 year ago

Displaying Paginator links in Javascript

Posted 1 year ago by Demers94

I'm making an AJAX call to my back-end to retrieve some resources. I want the results to be paginated because there are too many.

Is there a way to send the Pagination's HTML to the front-end via AJAX, so that I can display the page selection menu in my template?

Here's the code I'm using to retrieve the results :

$applications = Application::paginate();

        return [
            'results' => $applications->items(),
            'html' => $applications->links(),  

And here is my Javascript :

axios.get('/admin/applications/api').then(response => {
                    this.html =;
                    this.applications =;

I can get the results just fine, but the HTML part is just an empty object.

Is what I'm trying to achieve possible at all?


Please sign in or create an account to participate in this conversation.