Prevent browser caching of AJAX call result

后端 未结 21 1312
醉酒成梦
醉酒成梦 2020-11-22 04:47

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

21条回答
  •  心在旅途
    2020-11-22 05:16

    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.

提交回复
热议问题