...

View Full Version : Loading a file without using AJAX



dragon6158
06-24-2008, 02:52 PM
Hello,
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.

Thanks,
Don

tomws
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.

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

ohgod
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});
</script>


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">
Event.observe(window,'load',function(){
window.setTimeout("your function goes here",100);
});
</script>

Basscyst
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum