I have this little Javascript to read a json file and it works fine the first time I run it, but if I manually change the contents of the json file and then reload the page it keeps showing me the original contents. Can you please tell me what am I missing or what should I do to make sure fresh data is going to be read after every page reload? Many thanks in advance
This is my code
<html>
<head>
<script type="text/javascript" language="JavaScript">
function CheckForUpdate ()
{
// API for get requests
let fetchRes = fetch("https://www.fakehost.com/fakedir/filedata");
fetchRes.then(res =>
res.json()).then(d => {
var lastUpdated = d.updated;
alert (lastUpdated);
})
}
</script>
</head>
<body>
<script type="text/javascript" language="JavaScript">
CheckForUpdate ();
</script>
</body>
</html>
and this is the contents of the filedata.json file
{
"updated": 4
}