The normal flow is to have JavaScript manipulate the DOM. For example, I have a callback from a transaction executeSql on an openDatabase. The callback manipulates the DOM to add the result into a div.
But I have a special case where the page has to load correctly in toto. Yes, that’s right – I used the phrase in toto.
Q: Is there a way for JavaScript to pause the page load until call the callbacks have called back?
I’m thinking I will have to use document.write instead of $(‘body’).append().
It sounds as if you are making a callback, initiated when the page load begins, but you don’t want the page to display until the callback is complete.
Whatever the exact situation may be, the answer seems simple.
If you don’t want a page to load before some event finishes, then do it synchronously on the server instead of starting it asynchronously on the client. Then you won’t actually serve anything until it’s done, and, hence, nothing will appear.
If for some reason this is not possible, then render all your content “hidden” and show it when the callback finishes.