title: loop through MySQL result every 1 seconds using Ajax
body: <p>I have a class which gets a result from the database and the result is being looped through, and the database is being updated regularly but i dont want to keep refreshing the page because of some reasons.</p>
  
  <pre><code>//file class.php
  
   class order {
       function getOrders(){
       //gets data from database
  
       }
  
   }
  
  //file main.php
  
  $ai = new order();
  
  $orders = $ai-&gt;getOrders();
  
  foreach($orders AS $order){
  
   //data displayed in a table
  }
  </code></pre>
  
  <p>I want the table to be automatically updated without page reload.</p>
  
  <p>I know i have to use ajax but i have no idea what to implement that in oop</p>