I have a question regarding a issue that got me stuck with a personal project, I have a script that reads a .json file (or it is supposed to) every second and displays the data in to a HTML file. The problem is that when the .json file is modified(changed values every x seconds) the web page displays still the old first read values....
This is the code that i`m using :
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<p id="1"></p>
<script readtype="text/javascript" src="test.json"></script>
<script>
function update_values() {
var mydata = JSON.parse(JSON.stringify(data));
var test = mydata;
console.log(mydata);
document.getElementById("1").innerHTML = test;
}
update_values();
setInterval(update_values, 1000);
</script>
</html>
and this is the content of the .json fille:
data = ["value1", "value5", "value3"]
Can you please help me with a hint how can make it to do what it`s supposed to do?