Internet Explorer Caching asp.netmvc ajax results

前端 未结 7 878
故里飘歌
故里飘歌 2020-12-16 13:09

I\'m having an issue with a page in internet explorer. I have an ajax call that calls a form, in other browser, when I click the link it passes in the controller and load co

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 13:36

    You could try setting the cache option to false:

    $.ajax({
        url: '/controller/action',
        type: 'GET',
        cache: false,
        success: function(result) {
    
        }
    });
    

    This option will force the browser not to cache the request.


    UPDATE:

    Based on the comment you could add a unique timestamp to the url to avoid caching issues:

    var d = new Date();
    var myURL = 'http://myserver/controller/action?d=' + 
        d.getDate() + 
        d.getHours() + 
        d.getMinutes() + 
        d.getMilliseconds();
    

提交回复
热议问题