在下面的代码段中,如果请求的“profile.php”重定向到另一个页面,如“login.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或者文件名。