2012-08-31 53 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或文件名。

回答