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
More verbose version of Olafur's answer - The AJAX call is made and the function returns without waiting.
The callback doesn't finish until you've submitted the form.
What you should do is have the button/trigger calling the AJAX validation, and the callback should submit the form instead of returning true.