I am trying to use get_file_contents() in a setInterval() to repeatedly update some text which is displaying the contents of a file. Here's the code:
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<body>
  <div id="theDiv"></div>
</body>
<script>
$("document").ready(function(){
  setInterval(function(){
    $("#theDiv").text("<?php echo file_get_contents('file.txt'); ?>");
    console.log("<?php echo file_get_contents('file.txt'); ?>")
  },500);
});
</script>
The problem is: it seems that the text is not updating until I reload the page.
 
     
     
     
    