Hi, can you help me please i want to make pagination and display it to table. The data is from the database,but the problem is that i am lost with this code.I don't know what to do.can you help me please.


Code:
<?php
   include_once('configdb.php');



?>

<!Doctype html>
<html lang="en">

<html>

   <head>
       <script type="text/javascript" src="./jq_pagination/jquery/jquery.min.js"></script>
       <script type="text/javascript" src="./jq_pagination/jquery_pagination/jquery.pagination.js"> </script>
       <link  rel="stylesheet"  type="text/css"  href="./jq_pagination/jquery_pagination/pagination.css"/>

   <script type="text/javascript">

       var condata='';
       $(function (){
           $.ajax({
                 type: 'post',
                 url: 'getData.php',
                 success: function(mydata){
                     condata = mydata;
                 }

           });

       });


       function handlePaginationClick(new_page_index, pagination_container){
                var paginationItems = $('paginationNavigation').data(condata);
                startItem = new_page_index * this.items_per_page;
                endItem = Math.min(startItem + this.items_per_page,condata.length),
                i,
               newcontent ='';

             for(i=startItem;i<endItem;i+1){
                 newcontent = condata;
             }

             $('#datacontent').html(newcontent);

       }

       $("#paginationNavigation")

               .pagination(condata.length, {
                   items_per_page: 4,
                   callback: handlePaginationClick
               });

   </script>
   </head>
  <body>
   <div id="paginationNavigation">

   </div>

   <div id="datacontent">

   </div>

   </body>
   </html>
getData.php
Code:
<?php



   include_once('configdb.php');



      $sql  = $db->prepare("select * from abc");
     $sql->execute();

  echo" <table>";
    while($row=$sql->fetch(PDO::FETCH_OBJ)){

        echo"    <tr>
               <th>ID</th><th>studname</th><th>age</th>
            </tr>
             <tr>
               <td>".$row->id."</td>
               <td>".$row->studname."</td>
               <td>".$row->age."</td>
             </tr>";



    }

  echo "</table>";

?>