dpb75177 2014-01-28 19:12
浏览 74
已采纳

AJAX加载功能在IE10中不起作用

I have just finished my first AJAX request and got it working in Google, Safari Firefox ETC. It is very basic and just calls a PHP query with a random result and shows this inside a DIV. I then tested it in IE10 and the AJAX does not work. When i refresh teh page i get a new result but it does not refresh after 3 seconds. This is the code

$(function() {
    getStatus();
});

function getStatus() {
    $('div#status').load('thankyou.php')
    setTimeout("getStatus()",3000);
    setTimeout(function(){$("getstatus").html(getStatus)},3000);
}

I have looked for answers and got

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >

between my head and head. It cured another issue i was having with a jquery rotator but not the AJAX. Is it my code or IE10? and any known soulutions?

  • 写回答

1条回答 默认 最新

  • dongsha7215 2014-01-29 07:41
    关注

    Thanks to Crush and DownMaster i looked at the problem in a different way. By preventing the AJAX page being cached seems to makes it work, adding $.ajaxSetup({cache: false}); prevents the cache.

    $(function() {
    getStatus();
    });
    function getStatus() {
    $.ajaxSetup({ cache: false });//prevents the AJAX cache.
    $('div#status').load('thankyou.php')
    setTimeout("getStatus()",3000);
    setTimeout(function(){$("getstatus").html(getStatus)},3000);
    } 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?