title: Refresh a div which contains a PHP code, without refresing the page
body: <p>I have a php code, which is in a div. It shows a random text placed in the random.txt file. I want to refresh this div, to load new text in every - let's say - 15 seconds without refreshing the whoe page. 
  I've found several solutions to reload divs without refreshing a page and it seems it can be done with AJAX or JS, but they only refresh it with a specific content or a specific file, however I can't figure out how to insert this code and have it refreshed.</p>
  
  <p>This is how my div looks like:</p>
  
  <pre><code>&lt;div id="randomtext"&gt; 
  &lt;?php
  include_once("GetRandomText.php");
  $MPTextFile = "random.txt";
  $MPSepString = "*divider*";
  $MPTextToHTML = false;
  MPPrintRandomText($MPTextFile, $MPSepString, $MPTextToHTML);
  ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It loads a random text to the div at every refresh.</p>
  
  <p>I tried to refresh the div it with the JS below, but it's not working at all. Sorry, I'm not good in it.</p>
  
  <pre><code>&lt;script&gt;
  var auto_refresh = setInterval(
  function () {
  var newcontent= '&lt;?php
  include_once("GetRandomText.php");
  $MPTextFile = "random.txt";
  $MPSepString = "*divider*";
  $MPTextToHTML = false;
  MPPrintRandomText($MPTextFile, $MPSepString, $MPTextToHTML);
  ?&gt;';
  $('#randomtext').html(newcontent);
  }, 1000);
  &lt;/script&gt;
  
  &lt;div id="randomtext"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>