[Solved] JQuery $.post in a function. Wait for callback to define the return. [duplicate]

This is impossible. $.Ajax calls will always return immediately. You need to deal with the return when it is called through a callback (possibly several seconds later). Javascript never blocks for a given call. It may help to think of your code like this: //This entirely unrelated function will get called when the Ajax request … Read more