[jQuery] binding submit with ajax() inside

[jQuery] binding submit with ajax() inside


In the code below if i uncomment the return true; it will
automatically submit the data instead of running the ajax.. is there
anyway to get the $.ajax function to return the true or false value
for the submit function? or have that if statement at the bottom wait
for the $ajax to be done?
    $("form#register").bind("submit",function() {
        $.ajax({url: "registerajax",
            cache: false,
            type: "POST",
            dataType: "json",
            data: $("form#register").serializeArray(),
            success: function(data) {
                if(data.ErrorsFound != "") {
                    $("div#ErrorsFound").text(data.ErrorsFound);
                    $("form#register input").each(function(i, element){ $
(element).removeClass(data.removeClasses); });
                    $.each(data.requiredfields, function(i, required) {
                        if($("input#"+required.field).hasClass(required.classname) !=
true) {
                            $
("input#"+required.field).addClass(required.classname).focus();
                        }
                    });
                    return true;
                } else {
                    return true;
                }
            }
        });
        if($("div#ErrorsFound").text() == ""){
//return true
        }else{
            return false;
        }
     });