It looks like if I load dynamic content using $.get()
, the result is cached in browser.
Adding some random string in QueryString seems to solve this iss
If you are using IE 9, then you need to use the following in front of your controller class definition:
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public class TestController : Controller
This will prevent the browser from caching.
Details on this link: http://dougwilsonsa.wordpress.com/2011/04/29/disabling-ie9-ajax-response-caching-asp-net-mvc-3-jquery/
Actually this solved my issue.
Of course "cache-breaking" techniques will get the job done, but this would not happen in the first place if the server indicated to the client that the response should not be cached. In some cases it is beneficial to cache responses, some times not. Let the server decide the correct lifetime of the data. You may want to change it later. Much easier to do from the server than from many different places in your UI code.
Of course this doesn't help if you have no control over the server.
What about using a POST request instead of a GET...? (Which you should anyway...)