Title: Message
I was just browsing on one site and saw this _javascript_ fucntion. There is a login screen and when I click on Submit button it calls this fuction and process the request. This prevents refreshing of page. If I build that page in jsp instead of asp then how it will work. Any idea. The following function uses ActiveXObject which I guess we can't use in jsp or servlets.
 
function LoginUser() {
    window.status ="Processing..."
    var oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
    oXMLHTTP.open("get", "app/include/login.asp?paramLoginID=" + form1.txtLoginID.value , false, form1.txtLoginID.value, form1.txtPassword.value);
    oXMLHTTP.send("xmlDoc");
   //alert(oXMLHTTP.responseText)
 
    if (oXMLHTTP.responseText.search("ErrorChangePassword") > 0  ){
        alert("Please " +form1.txtLoginID.value +" change your password")
   // return true
    }
 

    if (oXMLHTTP.responseText.search("Error:") >= 0) {
        alert(oXMLHTTP.responseText);
        window.status ="Done"
        return false
    }
    if(oXMLHTTP.responseText.search("You are not authorized to") > 0 ) {
        alert("Invalid UserID / Password combination.\n\nPlease re-enter.");
        window.status ="Done"
        return false
    }
    //alert(oXMLHTTP.responseText.search("Error:"))
    //alert(GetCookie("DefaultPage"));
   document.location = "app/default.asp"
   window.status ="Done"
   return true
 }
 
Regards
Bhushan
 

Reply via email to