title: Load pages using jQuery/Ajax in the same div that loads a page every 6 sec?
body: <p>On my index.php I have a header, sidebar, footer and the main part of it is the <code>&lt;div id="feed"&gt;</code> that loads engine.php every 6000 ms.<br></p>
  
  <p>I have a Contact page ( contact.php ) in my sidebar. Instead of copying my index.php to a new page, with header, sidebar, footer and a main div for the contact content, can I load it in the #feed div of index.php withour refreshing the site in the browser?</p>
  
  <p>To summarize it, my question is, is there any way that my pages to be loaded on the same div ( #feed) without refresh and freeze the setTimeout timer?</p>
  
  <p>When the user click back on Home, then the engine.php is loaded and reloaded every 6 seconds.</p>
  
  <p>Maybe this can be done with Ajax, I don't know...<br></p>
  
  <p>Thank you for this and any examples/codes are highly appreciated.</p>
  
  <p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  $(function () {
      function loadfeed() {
          $('#feed')
              .addClass('loading')
              .load('engine.php', function () {
                  $(this).removeClass('loading');
                  setTimeout(loadfeed, 6000);
          });
      }
  
      loadfeed();
  });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>Having something like this works, but the engine.php loads after 6 sec. </p>
  
  <pre><code>$("#contactBtn").click(function() {
    $("#feed").load('contact.php');
  });
  </code></pre>