Currently the location of my Html is http://severname.com/qotw.html. Onclick of a button i call the login();
the login() javascript function, looks like this:
function login()
{
passwrd = document.f_signin.password.value;
username = document.f_signin.username.value;
if (username==""){ document.getElementById("response").innerHTML="<font color='red'>Enter your User Name to login.</font>";}
else if (passwrd==""){ document.getElementById("response").innerHTML="<font color='red'>You did not enter your password. Enter your password and try again.</font>";}
if (passwrd!="" && username!="")
{
xmlhttp=GetXmlHttpObject();
//alert("pass");
if(xmlhttp==null)
{
alert("Your browser does not support AJAX!");
return;
}
var url="login.php";
url=url+"?id="+username+"&passwrd="+passwrd;
xmlhttp.onreadystatechange=statechangedLogin;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
}
}
function statechangedLogin()
{
//alert(xmlhttp.readyState);
if(xmlhttp.readyState==4)
{
if(xmlhttp.responseText=="<font color='red'>Your User Name or Password is incorrect. Please try again.</font>")
{
document.getElementById("response").innerHTML=xmlhttp.responseText;
}
else
{
document.location="http://servername.com/login.php";
//document.getElementById("mainbody").
document.innerHTML=xmlhttp.responseText;
}
}
}
I want to display the response from login.php in the location "http://severname.com/login.php"
How should i do this? The location of the page changes from qotw.html to login.php, but the login.php does not displays anything inside it.
Zeeshan