Our login button looks like this:
<a href="#main" data-role="button" data-click="loginClick">Login</a>
If login succeeds the app should navigate to #main. If not, stay on the login view.
In our loginClick processing, we make an ajax call. If the login is not valid, we call e.preventDefault(); (which does not work)
The problem is that the ajax call is asynchronous (of course) and the view has already changed to #main even if the login failed.
How can we best implement the login failed logic?