ajax div刷新页面调用parent.window.location的问题

时间:2012-02-23 23:02:59

标签: php javascript ajax prototypejs

我有一个使用prototype.js库调用子页面的父页面。我在基于php mysql检查重定向用户时遇到问题。如果他从mysql表中删除,我想将用户重定向到新页面。除了调用parent.window.location =“http://www.mysite.com/index_use.php?bye”;的javascript之外,我的所有代码都正常工作。我在另一个页面上使用了相同的确切代码,它完全正常。我能错过什么。

原型代码:

    var myTimer5 = setTimeout("myFunction5();",5000);

function myFunction5() {
    var refint5 = 5000;
    var myAjax5 = new Ajax.Updater("userguestcheck","userguestcheck.php?id=<?php echo $pid; ?>&prevent_cache="+new Date().getTime(),{
        method:'get',
    onComplete:function(data) {
        var a5 = setTimeout("myFunction5();",refint5);
    }
    });
}

userguestcheck.php代码:

    <?php 
$iuajksdv = 9846598234;
include "include.php";
session_start();

//Added check for total user guest disconnect
$usercheck = mysql_query("SELECT nickname FROM useronline WHERE nickname = '".$_SESSION['username']."'");
$usercheckslect = mysql_num_rows($usercheck);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?php 
if($usercheckslect == '') {
    echo '<script type="text/javascript">
parent.window.location = "http://www.mysite.com/index_use.php?bye";
</script>';
} else {
}
// end disconnnect
?>
</head>

<body>
&nbsp;
</body>
</html>

0 个答案:

没有答案