如何在php中使用ajax重定向页面?

如何在php中使用ajax重定向页面?,php,ajax,Php,Ajax,如何在php中使用ajax重定向页面?我使用代码作为。。。成功登录后,我想将其重定向到另一个页面 enter code here var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }

如何在php中使用ajax重定向页面?我使用代码作为。。。成功登录后,我想将其重定向到另一个页面

enter code here
var xmlhttp;        
    if (window.XMLHttpRequest)
     {
        xmlhttp=new XMLHttpRequest();
     }
    else
    {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4 && xmlhttp.status==200)
            {   
                alert(xmlhttp.responseText);
                //document.images['imgtrue1'].src="../images/"+xmlhttp.responseText.split("#t#")[0];
                //document.getElementById("msg").innerHTML=xmlhttp.responseText;
            }
    }           
        //xmlhttp.open("GET","ref_cat_class.php?val="+val+"&val2="+val2,true);
        //alert(p);
            xmlhttp.open("GET","login_ajax.php?c_uid="+c_uid+"&c_pass="+c_pass+"&e_uid="+e_uid+"&e_pass="+e_pass+"&a_uid="+a_uid+"&a_pass="+a_pass,true);
            xmlhttp.send();
            //alert('hiii');

            document.getElementById("login").reset();   
}

您可以使用
window.location.href
,例如:

if(xmlhttp.readyState==4 && xmlhttp.status==200) {
    //check for xmlhttp.responseText for some status ; may be like 'success;
    window.location.href = "your-url-to-redirect-to";
}

使用ajax重定向没有任何意义-_-Ajax的要点是在不离开页面的情况下做一些事情……为什么要在这里麻烦呢?