This behavior has nothing to do with MII. This is all happening on the browser/client and is normal behavior. Even tho the call to go get the document from MII is async, Javascript is single threaded. The javascript engine asks the browser to go get the doc from the url and let it know when its done. The engine then continues doing whatever else it needs to do. When the browser is done getting the doc it lets the engine know. When the engine gets a chance and its not busy it will get to it and execute your callback function. So your browser may have gone and gotten the document but your javascript engine is still busy looping or whatever so your callback has to wait. If you want your 'after Load' to always execute after your 'inside load' you have to make your load call synchronous, or put it in your callback function, or use a promise.
↧