I've came across this situation a few times before and always found a tricky way to make it work but I'd like to know if there's a best practice for that: Sometimes you have to use several JavaScript SDKs on a page example: Google jsapi and jQuery.
Google calls this function when the SDK is ready to be used:
google.setOnLoadCallback(MyFunction);
jQuery does everything in this callback:
document.ready();
What if I want to manipulate the dom using jQuery AFTER Google's callback. What's the best way to tell the browser: "Wait for jQuery AND Google to be ready and do the stuff..." Is it best to have the jQuery callback nested inside Google callback? Or the other way round? I'm a bit confused.
You can do this in different ways, one of which is to use a global variable;
As a general solution, you can do as given below