[Javascript] Multiple ajax calls onload
Murphy, Matt
Matt.Murphy at thermofisher.com
Wed Jul 25 11:42:43 CDT 2007
All,
I thought I had this ingenious idea, to make a slow-loading page load
faster, I'd break up the sections into divs, and then call a series of
ajax functions to populate those divs asynchronously.
Problem is, only the last one called shows up. I can see in the firefox
error log that both document.getElementById('mydiv').innerHTML="myhtml"
calls ran, (the output of the php scripts called) but only one showed
up.
Here's the js I'm using to call my ajax functions:
<script language="javascript">
function loadparts() {
ajaxme('script.php?var=var');
ajaxme('script.php?var=var2')
}
</script>
<script>
window.onload = loadparts();
</script>
Should this work? Is there a better way?
Thanks,
Matt
More information about the Javascript
mailing list