I allready have this:
$(document).ready(function() {
// one time stuff
$.ajaxSetup({
cache:false
});
}
And i now it works cause i had a problem without it and i added it for a file that i read every 100ms. Only that was for this:
$.getJSON('output.json', function(data){
faceDetected = data.faceDetected;
frameCount = data.frameCount;
});
It doesn’t work for this:
function loadContent(page){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
$("#content").html(xmlhttp.responseText);
}
}
xmlhttp.open("GET", page, true);
xmlhttp.send()
}
Does someone know how to fix?
The first example is jQuery and the
cache: falsesetting is only about jQuery.The second is using the native
XMLHttpRequestobject. To bust the cache in the second example you could append a timestamp and a random number to the query string.You may take a look at the following blog post for a more elaborate solution.