Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: ajax debugging

  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts

    ajax debugging

    i'm trying to use ajax to check if a username already exists when registering

    I have

    Code:
    function zvalidateusername(username) {
        var validusername = true;
        //  alert(mobilenumber);
        http.abort();
        http.open("GET", "checkusername.asp?username=" + username, true);
        //alert("here");
        http.onreadystatechange = function() {
            if (http.readyState == 4) {
                myresult = http.responseText;
                  // alert(myresult);
                if (myresult != "True") {
                    // alert(myresult);
                    // validusername = false;
                    alert("שם משתמש נמצא כבר בשימוש במערכת");
                    return false;
                    //false
                }
                else {
                    return true;
                }
            }
        }
        http.send(null);
        // alert(document.forms['register'].ccvalid.value);
    
    
    
    }
    and then within my validation

    Code:
       if (!zvalidateusername(document.getElementById("x_Username").value)) return false;
    but this makes you not able to ever submit the form?
    why would this be>


    the following works in validation
    Code:
     if (!checkValidString(document.getElementById("x_Username").value)) return false;
            if (!checkValidString(document.getElementById("x_Password").value)) return false;

  • #2
    Senior Coder
    Join Date
    May 2004
    Posts
    1,456
    Thanks
    15
    Thanked 0 Times in 0 Posts
    I solved the issue

    i had to put the return true or return false at the end


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •