[Solved] Refresh table after seconds


You need to use $.ajax like

$(function(){
    function getdata(){
       $.ajax({
          url:'getdata.php',
          success:function(response){
              $('#dataTables-example tbody').html(response);
          }
       });
    }
    setInterval(function(){getdata()},5000);
});

getdata.php

<?php
     $req = mysqli_query($con, 'select user_id, user_name from users');
     while ($dnn = mysqli_fetch_array($req)) {
        echo "<tr>
                 <td>" . $dnn['user_id'] . "</td>
                  <td>" . $dnn['user_name'] . "</td>
              </tr>";
     }   
?> 

6

solved Refresh table after seconds