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:
//se
There is no cross-browser (cross-platform) event which gets that job done. There are some pretty specific mechanisms to watch objects propertys for instance, but nothing to watch out for booleans (imo).
You want to execute a callback function aswell at the time you're setting that variable to true. You can also apply some jQuery sugar:
function myCallbackReference() {
alert('yay');
}
$('#foobar').load('/some/code', function() {
menu_ready = true;
}).done( myCallbackReference );