Checking form input for an AJAX request
Bugs

You may think this code works, but it probably doesn't.

Example 1:


beforeSend: function () {
    return (checkAll());
    return (passwordCheck());
},



The passwordCheck function will never be called. Most probably you wanted this:

return checkAll() &amp;&amp; passwordCheck();


Example 2:


for (var i = 0; i &lt; arr.length; i++) {
    console.log(arr[i]);
    if (arr[i].trim() == '') {
        alert('Please Enter All Fields');
        return false;
    } else {
        return true;
    }
}



This for statement doesn't loop: it returns after checking the first value in arr, it won't check the others. Most probably you wanted this:

for (var i = 0; i &lt; arr.length; i++) {
    console.log(arr[i]);
    if (arr[i].trim() == '') {
        alert('Please Enter All Fields');
        return false;
    }
}
return true;


Also, a sligthly simpler way to check for blank value:

if (!arr[i].trim()) {


Efficiency

In passwordCheck you lookup $('#password') and $('#password') twice. It would be better to lookup only once and cache in a local variable, for example:

function passwordCheck() {
    var $password = $('#password');
    var $password_check = $('#password-check');
    var pass1 = $password.val();
    var pass2 = $password_check.val();
    if (pass1 != pass2) {
        $password.addClass('highlight');
        $password_check.addClass('highlight');
        alert("Passwords don't match");
        return false;
    } else {
        $password.removeClass('highlight');
        $password_check.removeClass('highlight');
        return true;
    }
}