user833129
user833129

Reputation:

How to create pagination with JQuery?

There is a html table which data are from a MySql database , got by using PHP. If there are many rows returned from the database then I want to show only 10 rows in the table and at the bottom of it there are numbers indicating a page-like indicator ( like when we google ). So how to achieve this pagination with JQuery ?

Upvotes: 1

Views: 889

Answers (2)

Carlos López-Camey
Carlos López-Camey

Reputation: 2515

You don't want to do the pagination in jQuery, since pagination's objective is to prevent fetching data you don't need. There's plenty of answers in Google, but the way I've done it in the client side is using datatables.

As for the server side pagination, PHP would get the number of items to fetch and the index of the starting item as parameters, then you would query the database with something like:

SELECT * FROM tablename LIMIT startingIndex, itemsToFetch;

Upvotes: 2

Soony
Soony

Reputation: 923

Maybe this would help

Upvotes: 1

Related Questions