View Full Version : Loading a file without using AJAX

06-24-2008, 02:52 PM
Does anybody know of a method to load a text file into an HTML document without using AJAX? I am tryng to load some tables that I use at work in several different web pages but with the AJAX asynchronous mode, the scripts that I am using start running before the tables are ready.


06-24-2008, 04:03 PM
The dynamic loading should be done onload, not inline. But, to your question, use a server side script (say, in PHP) to pull your data and drop it into the table as it's built.

06-24-2008, 04:17 PM
Yes, as tomws says, if you make the code execute onload the table should be ready.

06-24-2008, 04:23 PM
just in case it helps, you can use an event listener to watch for the page to be loaded

<script type="text/javascript" charset="utf-8">
Event.observe(window,'load',function(){your function goes here});

so once the page is loaded then it could call your ajax or whatever you please.

if you want it to wait a bit after loading before doing whatever it will do you could use the setTimeout method

<script type="text/javascript" charset="utf-8">
window.setTimeout("your function goes here",100);

06-24-2008, 11:26 PM
You can also set a hidden iframe's source to a text file and read from it if it is imperative that the data be processed after the page is loaded due to user interaction.