PHP Ajax Pagination with Load More Example

Mar 21, 2022 . Admin

Hello dev,

I am going to explain you how to Ajax load more pagination in PHP. You will learn load more results with jQuery,AJAX, and PHP. In side this article we will see How to load more data from database using jQuery Ajax with PHP.

This article will give you simple example of load more pagination with PHP & Ajax. We will use get simple How to PHP Ajax pagination with load more.

I will give you simple Example of How to load more results in PHP, Ajax and MySQL From Database.

So, let's see bellow solution:

<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>PHP Ajax Pagination with Load More -</title>
    <link rel="stylesheet" href="">
    <script src=""></script>
    <div class="container mt-5">
        <div class="row">
            <div class="col-md-12">
                <div class="card-header text-center bg-dark text-white">
                   <h4>PHP Ajax Pagination with Load More -</h4> 
                <table class="table table-bordered" id="loadData">

    <script type="text/javascript">
            function loadMoreData(page){
                    url : "load.php",
                    type: "POST",
                        if (data) {
                            $(".loadbtn").prop("disabled", true);
                            $(".loadbtn").html('That is All');
            $(document).on('click', '.loadbtn', function(){
                var pId = $(this).data("id");

    $sernamename = "localhost";
    $username     = "root";
    $passoword   = "";
    $databasename= "demos";

    $con = new mysqli($sernamename, $username,$passoword,$databasename);

    if ($con->connect_error) {
      die("Connection failed". $con->connect_error);

    $limit = 5;

    if (isset($_POST['page_no'])) {
      $page = $_POST['page_no'];
      $page = 0;

    $sql = "SELECT * FROM users LIMIT $page, $limit";
    $query = $con->query($sql);

    if ($query->num_rows > 0) {
        $output = "";

        $output .= "<tbody>";

        while ($row = $query->fetch_assoc()) {
            $last_id = $row['id'];


        $output .= "<tbody>";
        $output .= "<tbody id='pagination'>
                            <td colspan='5'><button class='btn btn-success loadbtn' data-id='{$last_id}' style='margin-left:500px'>Load More</button></td>
        echo $output;     


It will help you...