I’m, making a simple AJAX call on page load…
$(document).ready(function() {
$.get('', {'format': 'json'}, function(items) {
console.log('hello');
}
}
If I hit a link on the page, then use the back button, the code above runs (it outputs ‘hello’ to the console), but the request never hits the server, it just uses the response it had originally as if it was cached.
Is it possible to force it to hit the server?
If you use the
$.ajax()method then you can setcache:false. The following is the equivalent of your$.get()call:Or set a default for all ajax calls: