Making sure AJAX loads & visitor wont need to refresh

Making sure AJAX loads & visitor wont need to refresh

I am using .load to bring in two chunks of content as a page is loading.

Most of the time this works well.

This is a site that is not public yet. It is in development.

Some of the time the AJAX content does not load and the visitor sees a crippled page and would have to do a browser refresh. A browser refresh action does cure the problem.

What can I do to make sure the AJAX content loads when the page loads so that the visitor does not see a crippled page and need to use REFRESH?

Here is the code that does the load;
 <script type="text/javascript">
      $(document).ready(function()
     {

 //*   alert("We have the script running");
    
 $("#narrativebox").load("../input/input_1953_10_22_construction_kibitzer.htm #narrative",function(){ $('a.gallery').colorbox({rel:'gal'});
       
});  
 $("#textbox").load("../input/input_1953_10_22_construction_kibitzer.htm #text",function(){ $('a.gallery').colorbox({rel:'gal'});
 });       
});  
 </script>