Simple Ajax Pagination with PHP

In previous tutorial we have learn Simple tutorial of pagination in php, here we will learn php pagination with ajax.now days we are using ajax functionality for each request.We are using jQuery library for Ajax request and MySQL for database.

We have following files:
1- db.php : This file contains db connection information.
2- pagination.php : this file return html table as a response.
3- index.php :This file is used as a requester.

Checkout other tutorials of pagination,

To create Ajax pagination we need to follow below steps:

Step 1:Create db.php and put below connection code in this file.

Step 2:Created index.php file and putted below code into this file.

Step 3:Created pagination.php and putted below code into this file.

Result :

You can check live demo and download source code from below link,

18 thoughts on “Simple Ajax Pagination with PHP

  1. Hi, very useful tutorial.. this jquery load function was not working on server..but its working perfect on local server only .. can u say any other solution? thanks in advance

      • Hi, now its working fine..im using urs Advanced AJAX Pagination with PHP and Mysql script. if i use where condition on pagination page, it doesn’t work. i don’t know, how to pass table id?… can u help me..
        @ pagination page:- $sql = “select * from review where advertiserid=’$aid’ order by reviewid desc LIMIT $start_from, $limit”;

      • Hi, i solved this problem, now its working perfect. i had added table id into script
        jQuery(“#target-content”).load(“pagination.php?aid=&page=” + pageNumber );
        can u say?.. this pagination have prev & next button only, how can i show the first & last button?

        i had tried in php but its doesn’t show these buttons

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.