For example, I have var menu_ready = false;. I have an ajax function that sets menu_ready to true when the ajax stuff is done:
//set up event listener here
$(...).load(..., function() {
...
menu_ready = true;
}
How do I set up an event listener that waits for menu_ready to be true?
WARNING My answer below is from a period slightly prior to the sailing of the Mayflower. It’s a bad answer. I can’t remove it because it was accepted, and the system won’t let me remove an accepted answer. I could edit it to make it better, but why do that when others have given solid answers below? Bottom line: scroll past this to a more fulfilling life. 🙂