$.getJSON returning cached data in IE8

前端 未结 7 1452
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 16:38

I\'m playing around with ASP.net MVC and JQuery at the moment. I\'ve come across behavour which doesn\'t seem to make sense.

I\'m calling JQuery\'s $.getJSON

7条回答
  •  囚心锁ツ
    2020-11-29 16:59

    Thanks Kent for your answer. Using $.ajax('{ cache: no }'); worked perfectly. [edit]

    Or at least I thought i did. Seems that the jquery $.getJSON isn't reading any changes made to the $.ajax object.

    The solution that ended up working was to add a new parameter manually

    var noCache = Date();
    $.getJSON("/somepage/someaction", { "noCache": noCache }, Callback);
    

    the date resolution is only to the minute; which effectively means this solution still caches for upto one minute. This is acceptable for my purposes.

提交回复
热议问题