07-24-2023, 06:00 AM
This is the sample code I'm going to Use
<script>
$(document).ready(
function() {
setInterval(function() {jQuery(document).ready(function($){
$.ajax({
url : "test.txt",
dataType: "text",
success : function (data) {
var tokens = data.split("\r\n");
document.getElementById("testClass").innerHTML = tokens[0];
}
});
});}, 2000);
});
</script>
As you can see the file shall be read at an interval of 2 second, and that data will used for some other purpose... The problem that arises is "I think is it downloads the file only once and then uses the same file over and over, hence if the file updates I'll not be able to see the updated file, so is there any way to stop this caching?"
Thanks in advance
<script>
$(document).ready(
function() {
setInterval(function() {jQuery(document).ready(function($){
$.ajax({
url : "test.txt",
dataType: "text",
success : function (data) {
var tokens = data.split("\r\n");
document.getElementById("testClass").innerHTML = tokens[0];
}
});
});}, 2000);
});
</script>
As you can see the file shall be read at an interval of 2 second, and that data will used for some other purpose... The problem that arises is "I think is it downloads the file only once and then uses the same file over and over, hence if the file updates I'll not be able to see the updated file, so is there any way to stop this caching?"
Thanks in advance