title: How to be sure that rendering is complete after AJAX request
body: <p>After an AJAX request to download a fragment of html, xmlhttp.readyState goes to 4 when the download is complete. It looks like readyState == 4 says nothing (and should say nothing, imo) about the browser's progress in rendering the downloaded matter.</p>
  
  <p>So if my JS depends only upon readyState == 4 before starting to use the downloaded html, I stand a good chance of getting 'whatever_var is undefined' when the JS begins to execute. I don't want that.</p>
  
  <p>How can I find out for sure when the browser is all done rendering?</p>
  
  <p>I'm not using jquery or any other framework.</p>
  
  <p>Test case that shows the problem: <a href="http://www.sellmycalls.com/cgi-bin/chain" rel="nofollow noreferrer">http://www.sellmycalls.com/cgi-bin/chain</a> and then when the short page appears, press either of the green buttons in the menu box on the left (labeled "all options" and "watchlist"). Repeat a couple of times and the problem appears. If it looks like the page is hung up, close its tab and bring it up in a new tab.</p>
  
  <p>Use Firebug/FF to see the error on the page; I don't claim in runs in any other browser.</p>
  
  <p>The first time you load this page, you might see some intro material. Dismiss the intro box with the "hide intro"/"hide help" uncolored button in that menu box on the left. The error message on the console will be something like "cx_usrname is undefined". (There's also another error that shows up on this page: "unhandled exception ..." That's a different problem that I'm not worried about yet.)</p>