jQuery的阿贾克斯刷新不工作在IE浏览器 [英] Jquery Ajax refresh not working in IE

查看:110
本文介绍了jQuery的阿贾克斯刷新不工作在IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个< UL> 这刷新每十秒钟检查是否有过任何新的鸣叫(从Twitter的饲料其拉)。这工作正常,在Firefox和Chrome浏览器等,但它并没有在任何版本的工作,如果Internet Explorer。

I have a <ul> which refreshes every ten seconds to check if there have been any new tweets (its pulling from a twitter feed). This works fine in Firefox and Chrome etc, but it does not work in any version if Internet Explorer.

我的code是如下:

setInterval(function() {
    $("#banter .scroll-pane").load(location.href+" #banter .scroll-pane>*","");
}, 10000);

我的PHP函数创建的列表如下:

My PHP function creating the list is as follows:

function showTweets($section, $limit, $class) {
    $result = mysql_query("SELECT * FROM hash WHERE section = '".$section."' ORDER BY date DESC LIMIT ".$limit);

    echo '<ul class="scroll-pane '.$class.'">';
        while($row = mysql_fetch_array($result)) {
            echo '<li>';
                echo '<p>'.html_entity_decode($row['tweet']).'</p>';
                echo '<a href="'.$row['user_url'].'">'.$row['user'].'</a>';
            echo '</li>';
        }
    echo '</ul>';
}

任何想法是怎么回事? 谢谢

Any idea what's going wrong? Thanks

推荐答案

我设法解决它,原来它是一个缓存的问题与IE浏览器。因此,要解决这个问题,我把包含UNIX时间上的调用PHP文件的最后一个唯一的查询。例如:

I managed to fix it, turns out it was a caching issue with IE. So to fix it I put a unique query containing the unix time on the end of the call to the PHP file. For example:

setInterval(function() {
    $("#banter .scroll-pane").load('test.php'+"?ms=" + new Date().getTime());
}, 6000);

完美!

这篇关于jQuery的阿贾克斯刷新不工作在IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆