When a function executes Synchronously, the following statement is NOT executed until the previous one is done executing - ex:
/* here, the statements are executed one after the other. In other words, if the web server is experiencing delays and it takes 5 seconds to respond then you will see the second alert 5 seconds after the message "Checking Username".
var username = makeSJAXCall();
By contrast, Asynchronous calls do NOT wait for completion before moving on to the next statement - ex:
here you see the "Checking Username" message and almost immediately after that you will see the second alert. Since the Asynchronous function has not completed, username does not have a value and you should see undefined as the second message.
So how do you "campture/receive" the result. This is where the callback function comes into place, which is what is typically executed onreadystatechange.
var username = makeAJAXCall();