I'm using this ajax function to reload an html page to a division in web page.
<script>
$('#scene_container').load('scene.html', function () {
cache: false
});
</script>
html:
<div id="scene_container"></div>
But most of the time it loads cached webpage. How to load the original html page?
Preventing cache is not available with the load method unless you disable it globally
But you can make sure no data will be loaded from cache by appending a time parameter to the request URL
url = "scene.html";
url += '?_=' + (new Date()).getTime();
To control caching on a per-request basis, you need to use a more complex function like $.ajax() .
Insert this at the top of your script:
$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});
MANUAL
ANother way is to use an unique id like this to the end of the url:
$('#scene_container').load('scene.html?uid'+uniqueId());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With