The return value from the success call has nothing to do with whether or
not the link is followed. That's because Ajax is (normally)
asynchronous. The link will already have been followed (or not) in the
past.
You can return false in the .click() callback
function to prevent following the link. However, the modern jQuery
way is to use preventDefault():
$('#login').click(function(e) {
e.preventDefault(); // Now it will not follow the link
...
}
If you want to follow
the link AFTER you have gotten the .success() callback, you have to do it
yourself. You will have to retrieve the
href
attribute from the link and
call the page change function. (Exactly how you do that depends
on the version of JQM you are using, and you haven't
mentioned it, so see the docs).
My understanding is in
jqmobile, a return of true will ensure the <a
href> link is followed. Anything other than a true
return means the link is not followed.
Not
specific to jQuery Mobile. It's actually a DOM-methods thing,
which is carried through in jQuery. But it's the opposite.
Returning
false
from some event callback prevents the default action of the
event. Returning anything else allows the default action to be performed.
But do it the
modern, jQuery way as I showed above. Use
.preventDefault()
. Return false will
also prevent bubbling, which you may not want. jQuery
separates the two concerns, if you want to prevent bubbling
you can use .stopPropagation()
as well.