Trying to get this to work for sometime now:
function check_for_acc() {
$(\"#usr_login_attp\").val(\"ok\");
Yep! You're thinking that the success
handler will execute before the rest of your script does. That's almost certainly incorrect.
The processing of the login success/failure needs to happen within the callback. Once you call check_for_acc()
, it makes the Ajax call--but the callback doesn't get called until the Ajax call completes. Meanwhile, your code runs merrily along.
Alternatively, you could use the jQuery.when() function to wrap up some of that hoop jumping for you.