Hi, i have this code and for some reason, it never executes the second if statement (session). Can someone tell me why? It does return the action as session too.
You can see the script in action here: click login button.
Any Ideas??
Regards,
Martin
Computing Help And Info:
You can see the script in action here: click login button.
Code:
function handleResponse() {
var ans;
if(http.readyState == 4 && http.status == 200){
// Text returned FROM the PHP script
var response = http.responseText;
var result = eval(http.responseText.split("||"));
var action = result[0];
var retdata = result[1];
//alert(action);
if(response) {
// UPDATE ajaxTest content
//var ret = substr(response,0,1);
//if (ret == "Y"){
// document.getElementById("loginStatus").innerHTML = "Login Successful";
//}else{
// document.getElementById("loginStatus").innerHTML = "Login Failed";
//}
if(action == "login"){
if(retdata == "Y"){
ans = "Login Successful";
document.getElementById("loginStatus").innerHTML = ans;
action = "";
setTimeout("showUpdate()",1000);
}else{
ans = "Login Failed";
document.getElementById("loginStatus").innerHTML = ans;
action = "";
}
}
if(action == "session"){
alert("lol " + retdata);
document.getElementById("loggedUser").innerHTML = retdata;
action = "";
} //else{
// alert("dno");
// action = "";
//}
}
}
}
Regards,
Martin
Computing Help And Info: