So recently I improved my code and managed to save a javascript variable through PHP(AJAX) to a txt file. The txt is working and it gets the javascript number but I'm having problems retrieving the number on the txt file.
PHP code:
<?php
$file_content = file_get_contents('num.txt');
?>
Javascript code:
function recnum(){
document.getElementById("num").innerHTML = '<?php echo $file_content; ?>';
}
So after this, the number on the html page stays the same (1) and doesn't change.
1
It is not getting the new value given by the text file. – Miguel Casanova Jun 27 '18 at 10:02