I have this function to read a text file from a specific location:
<html>
<head>
<script>
function readTextFile(file){
var out_text=''
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function (){
if(rawFile.readyState === 4){
if(rawFile.status === 200 || rawFile.status == 0){
var allText = rawFile.responseText;
out_text=allText;
}
}
}
rawFile.send(null);
return out_text;
}
</script>
</head>
<body>
<div id="file_txt"></div>
<script>
txt = readTextFile('http://arbsq.net/dchampolu/champolu_data.txt');
document.getElementById("file_txt").innerHTML=txt;
</script>
</body>
</html>
The thing is that I want to read a text file that continuously changes: http://arbsq.net/dchampolu/champolu_data.txt
when I run this function once, the browser caches the text file, and then every time I run the code, it only gets the cached version, not the updated version.
I can always tell the users to clean this cache and this sort of stuff, but is there a way by JavaScript or jQuery to force the browser to use only the current version of the file, not the cached version?