anton24 0 Newbie Poster

I have a form which action is a php script.
That script returns a header('Location: whatever.html');

Now my question is, would be a way through ajax/javascript to do that only the form were sent, but avoid or prevent the redirection to whatever.html? Also, if would be possible know the page where I was going redirected to... but this is secondary, and I'm asking too much.

I've tried with:

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)
{
alert(xmlhttp.getAllResponseHeaders());
}
}

xmlhttp.open("POST","action.php",true);
xmlhttp.send();

But in the alert it doesn't give me any Location.

Hope you can understand me.
Thanks in advance.