Fixing These jQuery! A Guide to Debugging
You cannot combine the previous two non-working techniques to create something that works
Don’t feel bad, everybody tries this once
functiongetContent() {varstuff;$.get("remote.php",function(data) {stuff = data;});returnstuff;}varnewContent = getContent();// newContent === undefinedThis is a very bad idea. Just like $.get()does not wait for the callback to finish, neither will the containinggetContentfunction
source:
$link[host]
Read Original Source