DataTables is a jQuery library for implementing pagination.
For adding AJAX pagination needs to write a long script that – count total records with and without filters, fetch records, initialize Array with data, and return the JSON array with required fields.
In Laravel, there is a Yajra DataTables package that makes this pagination process a little easier to implement.