I'm running this simple javascript on a Flask server, the idea is that whenever there are changes on the status.json
file they are shown in the text_here div without needing to reload.
function refreshdata(){
$.getJSON("static/json/status.json", function(data){
document.getElementById("text_here").innerHTML = JSON.stringify(data, null, 2)
console.log("success")
});
}
refreshdata();
setInterval(function(){
refreshdata()
},5000)
The html includes the line <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
.
When I first load the page the json file is rendered properly, but when I make changes on the json they don't reflect on the page afterwards. In fact, it doesn't even show any changes unless I hard reload the page. The script does console log 'sucess' every time though. Any way to fix it? thanks