title: auto load data from database using jquery
body: <p>I would like to display newly inserted data from database. I found the below code from another question and it does what I want but it only shows the data when clicked. So can someone tell me how can I make the data auto load every 5 secs? </p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
  
   $(document).ready(function() {
  
    $("#display").click(function() {                
  
    $.ajax({    //create an ajax request to load_page.php
      type: "GET",
      url: "second.php",             
      dataType: "html",   //expect html to be returned                
      success: function(response){                    
          $("#responsecontainer").html(response); 
          //alert(response);
      }
  
  });
   });
  });
  
  &lt;/script&gt;
  
  &lt;input type="button" id="display" value="Display All Data" /&gt;
  &lt;div id="responsecontainer" align="center"&gt;
  </code></pre>