Calling server side via javascript

Bhushan Bhangale <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Organization Fusion Technologies
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.