2012-08-31 49 views
0

在下面的代码段中,如果请求的“profile.php”重定向到另一个页面,如“login.php”,如何识别它。在AJAX调用中获取重定向的php页面名称

x=new XMLHttpRequest(); 
x.open("GET","profile.php",true); 
x.onreadystatechange=function(){ 
if(x.readyState==4&&x.status==200) 
{ 
alert("Requested url(profile.php) is loaded"); 
document.getElementById('content').innerHTML=x.responseText; 
} 
} 

我们通过responseText成员获取页面内容,是否可以获取请求的对象的url或文件名。

回答