So I'm doing an operation inside the javascript to attribute a javascript variable to a php value that is obtained via txt file. But I want to repeatedly refresh. I've seen a few questions on this website like this one but didn't do the trick for me.
PHP code:
<?php
$file = "nam.txt"; //Path to your *.txt file
$contents = file($file);
$nam = implode($contents);
?>
Javascript code (with setinterval but for now that is not working):
setInterval(function(){
document.getElementById("nam").innerHTML = '<?php echo $nam; ?>';
}, 50);