开发者

$_GET[] with Ajax in IE 7

I have some code which uses some standard ajax:

function getLiveGame()
{ 
    var gameid = "<?php echo $gameid ?>";  
    var xmlhttp;    
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
 开发者_StackOverflow社区           document.getElementById("livegame1").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","livegame2.php?&refresh="+Math.random()+"&gameid="+gameid,true);
    xmlhttp.send();
}

^Note the url it has also includes a Math.random to stop IE caching and also a 'gameid' which will be $_GET'ed later...

Now on livegame2.php the first few lines of code are:

$gameid = $_GET['gameid'];

echo $gameid;

Now on the page where this ajax is ran...

On firefox it says: 15 (which is the correctly passed gameid)

On IE it says: undefined (which is incorrect)

How can I get it working for IE/what is the problem?

Thanks alot,

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜