Having a problem where the form submits before the validateUsername function has a chance to complete the username check on the server-side.
How do I submit the form
Why dont you just use $('#yourFormId').submit(); after you have received a result from your ajax backend?
$('#yourFormId').submit();