You start by clicking Submit after you enter username and password in textfields
Login HTML (just the submit part)
<a onclick="loginajax();" onmouseover="ChangeColor('loginsubmit', '000000');" onmouseout="ChangeColor('loginsubmit', 'ffffff');" style="cursor:default"><font color="#FFFFFF" id="loginsubmit"><b>Submit</b></font></a>
The submit button runs loginajax();
aj_makerequest(location of file, where to put the output via ID, javascript to run if ajax request goes through, Custom Error message if ajax doesnt go through, Is It a input tag);
loginajax();
function loginajax(){
AjaxWait("loginfail");
var passlogin=document.getElementById('passlogin').value;
var userlogin=document.getElementById('userlogin').value;
aj_makeRequest("includes/Login.php?userlogin="+userlogin+"&passlogin="+passlogin+"","hiddenlogin","","No SQL","YES");
}
The ajax runs a php code the checks a database and starts a session then brings back output ether "PASS" or "FAIL" and places it in a input tag that is in a display:hidden table that should onchange run logincheck();
<input type="text" id="hiddenlogin" onchange="logincheck();"/>
Logincheck();
function logincheck(){
res = document.getElementById("hiddenlogin").value;
if(res == "PASS"){
document.getElementById("loginfail").value = "<font color=\"#1D700E\"><b>PASS</b></font>";
location.reload(true);
}else if (res =="FAIL"){
document.getElementById("loginfail").value = "<font color=\"#C40000\"><b>FAIL</b></font>";
}else if (res == "No SQL"){
document.getElementById("loginfail").value = "<font color=\"#C40000\"><b>No SQL</b></font>";
}
}
My problem is that it doesn't run Logincheck(); when the the value is changed in id="hiddenlogin" by the php "PASS" or "FAIL"
Anyone know whats wrong????? Thanks alot
This post has been edited by ARCSET: 27 February 2009 - 04:34 PM

New Topic/Question
Reply



MultiQuote




|