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:
var menu_ready = false;
menu_ready
//se
Why do not create a function menuReady that will be fired when you want ?
menuReady();