aside from the fact that checkIfUsername does not have a return
ajax function is not going to waitwhen you finished calling $.ajax your
function has already ended(returned)
then when server responded your returnUsernameBool will be called but thats
already too late for your alert(bValid)

thinking as $.ajax is creating another thread and your callback is run in it
might help (eventhough javascript is single threaded)

Reply via email to