function onload_hide_sublist(){ document.getElementById("sublist").style.display = "none"; document.getElementById("loadingttxt").style.display = "none"; } var redirecting_url; function doLogin(url) { redirecting_url = url; var form = document.forms["login_form_ajx"]; var email = escape(form.email.value); var password = form.password.value; var is_error_login = false; if(email == '' || email == ' '){ document.getElementById("email_err").style.display = ""; document.getElementById("email_err").innerHTML = "Please provide email address"; is_error_login = true; } if(password == '' || password == ' '){ document.getElementById("password_err").style.display = ""; document.getElementById("password_err").innerHTML = "Please provide password"; is_error_login = true; } if(is_error_login == true){ return false; } http=createRequestObject() if (http==null) { alert ("Browser does not support HTTP Request."); } document.getElementById("responsetxt").style.display ="none"; document.getElementById("login_form_ajx").style.display = "none"; document.getElementById("loadingttxt").style.display = ""; document.getElementById("loadingttxt").innerHTML = " Please wait processing.."; http.open('POST', 'ajax_action/login_action_ajax.php'); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.onreadystatechange = HandledoLogin; http.send('email='+email+'&password='+password+''); } function HandledoLogin() { if((http.readyState == 4)&&(http.status == 200)){ var response = http.responseText; var string_response = response.split("|"); var form = document.forms["login_form_ajx"]; if(string_response[0] == 0){ document.getElementById("sublist").style.display = ""; document.getElementById("responsetxt").style.display =""; document.getElementById("responsetxt").innerHTML = string_response[1]; document.getElementById("loadingttxt").style.display ="none"; document.getElementById("login_form_ajx").style.display = ""; }else{ document.getElementById("loadingttxt").style.display = ""; document.getElementById("sublist").style.display = ""; document.getElementById("responsetxt").style.display =""; document.getElementById("responsetxt").innerHTML = string_response[1]; document.getElementById("loadingttxt").innerHTML = " Please wait redirecting.."; document.getElementById("login_form_ajx").style.display = "none"; window.location= redirecting_url; } } }