Is there a callback for the html() function or a way to check that it is finished. For example:
$(\"#some_div\").html(\'something here\');
if($(\"#some_div\
html() is a synchronous operation. The actual updating of the DOM depends on what your html content is. If you have or tags, they will take time to load. The next statement following the html() should immediately see the new html contents.
Did you mean load() instead?
[Edit] Based on your comment, it is probably your $.ajax failing. Not html(). Try attaching a failure handler to ajax call and retry from there? Although, if your server side code silently fails with a 200 code, the failure event doesn't get called. In that case, you can validate the html value before you set it to the element.