在IE 9中使用jQuery加载函数后的奇怪行为

时间:2013-06-04 18:32:58

标签: php jquery internet-explorer load internet-explorer-9

所以我有这个代码适用于我的所有浏览器,但在IE中有一个奇怪的行为。

$(document).ready(function () {
    //$.ajaxSettings.cache = false;
    var refresh = setInterval(function () {
        $('div#top_right').load('refresh.php?randval=' + Math.random() * 99999);
    }, 5000);

    $.ajaxSetup({
        // Disable caching of AJAX responses 
        cache: false
    });
});

这会重新加载我的用户面板div并检查是否有任何新消息等(并且您可以看到我尝试修改IE缓存)。这适用于所有浏览器,甚至是IE,但在第一次重新加载后的IE中,它会删除用户面板div中链接(例如消息链接)的所有href属性。我不知道为什么会这样。请帮帮忙?

这是refresh.php的代码:

<?php
session_start();
include_once 'functions.php';
$user = $_SESSION['user'];
$new_message = FALSE;
$new_friend = FALSE;
$new_reply = FALSE;
$query = "SELECT status FROM messages WHERE recip='$user'";
$result = queryMysql($query, "divs");
while($row=mysql_fetch_assoc($result)){
    if($row['status']=='new') $new_message=TRUE;
}
$query2 = "SELECT status from friends WHERE user='$user'";
$result2 = queryMysql($query2, "nezworld");
while($row2=mysql_fetch_assoc($result2)){
    if($row2['status']=='pending') $new_friend=TRUE;
}
$query3 = "SELECT status from replies WHERE recip='$user'";
$result3 = queryMysql($query3, "divs");
while($row3=mysql_fetch_assoc($result3)){
    if($row3['status']=='new') $new_reply = TRUE;
}

?>
<div id="top_right"><ul id="login2">
            <li class="user_nav"><a href="profile.php?view=<?php echo $user; ?>" class="white"><?php echo $user; ?></a></li>
            <abbr title="Home"><a href="index.php" class='white'><li class='icons home'>N</li></a></abbr>
            <abbr title="Messages"><a href="message.php?view=<?php echo $user; ?>" class='white'><?php if($new_message){?><li class='icons2 messages2'><?php }else{?><li class='icons2 messages'><?php }?>M</li></a></abbr>
            <abbr title="Replies"><a href="replies.php?view=<?php echo $user; ?>" class='white'><?php if($new_reply){?><li class='icons2 replies4'><?php }else{?><li class='icons2 replies2'><?php }?>R</li></a></abbr>
            <abbr title="Friend Requests"><a href="friends.php?view=<?php echo $user; ?>" class='white'><?php if($new_friend){?><li class='icons2 friends2'><?php }else{?><li class='icons2 friends'><?php }?>F</li></a></abbr>
            <li><a class="submit" class='white' href="logout.php">LOGOUT</a>
                </form>
            </li>
        </ul></div>

0 个答案:

没有答案