I have a little issue with my site. I have a page that hosts a google map. However the map does not get shown until the user clicks a button. It then call $.getJSON to get the addresses that i need to show on the map...
$.getJSON(theurl, function(json) {
...
}
It all works fine. However if the user then moves to a different page and then clicks the Back button they get the data from the $.getJSON call displayed, not the page itself.
It's as if the call to get the addresses has become part of the browsing history. If the user hits refresh when the data appears the full page then gets displayed.
Can anyone tell me how to stop this from happening.
I'm using the googlemap in an ASP.Net MVC site.
Thanks
I solved it by including the below code just before the $.ajax function
$.ajaxSetup({ cache: false });
It works! Try it
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