I'm trying to make a form to signup to my site but AJAX is not returning false for an onsubmit.  Here is my code:
var c = false;
var h = true;
function hi(g, j, k) {
    if (g == j) {
        h = false;
    }
}
function validateForm() {
    var x = document.forms["hi"]["pass1"].value, v = document.forms["hi"]["pass2"].value, b = document.forms["hi"]["user"].value;
    if (x != v) {
        alert("Passwords must match");
        return c;
    }
    xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            var a = this.responseText.split("\n")
            for (var n in a) {
                console.log(a);
                console.log(a[n]);
                console.log(b);
                hi(a[n], b, this.responseText)
                if (a[n] == b) {
                    alert("Username already exists")
                    return c;
                };
            };
        };
    };
    xmlhttp.open("GET", "http://www.ncpcs.com/carter/user.txt", true);
    xmlhttp.send();
    return h;
}`
and the onsubmit has  return validateForm()
 
    