Submitting a form when using an onSubmit
<p>My form onSubmit is calling:</p>

<pre><code>onsubmit="validate(this); return false;"
</code></pre>

<p>validate() is as follows:</p>

<pre><code>function validate(obj) {
    $.ajax({
        url : "ajax/validate_check.php",
        type : "POST",
        data : $("#" + obj.id).serialize(),
        success : function(data) {
            $('#' + obj.id + ' :input.form_errors').removeClass('form_errors')
            data = $.parseJSON(data);
            if(data['error_count'] &gt;= 1) {
                $.each(data, function(i, item) {
                    $('#' + i).addClass('form_errors');
                });
            } else {
                $('#' + obj.id).submit();
            }
        }
    });
}
</code></pre>

<p>When I have 0 errors it's trying to submit the form but I'm getting an infinite loop. I realize it's happening because my onSubmit calls the function again. How do I actually submit the form when I'm ready? What is the proper way to approach this? </p>
