Event/Timing problem when loading data from xml...

E

ezmiller

Hi,
I have a web page that loads some data from a series of xml files into
a series of arrays. After that, a series of function process that data
in the arrays for display on the web page.
The problem I am encountering is that in some cases that functions that
process the data
from the arrays for dispaly are being called before the arrays have
been created (i.e. they are still "undefined").

The functions loading the data from the xml files are called from the
onload event of the body tag. What I need to do is figure out how to
call the functions which process the data in the arrays at such a time
when I can be sure that the arrays are all loaded, or I need a way to
check and see if the arrays exist and if not wait until they do... But
I can't discover a good way to do this. Any ideas?

Best,
ezmiller
 
V

VK

ezmiller said:
Hi,
I have a web page that loads some data from a series of xml files into
a series of arrays. After that, a series of function process that data
in the arrays for display on the web page.
The problem I am encountering is that in some cases that functions that
process the data
from the arrays for dispaly are being called before the arrays have
been created (i.e. they are still "undefined").

It is like to buy white shoes first and then polish them with black wax
because you actually don't like the white color. No offence but the
logic and actions consecution is very similar. :)

You don't need XML intermediary media. Actually you never need XML if
you plan to handle data *manually*.

....
<script type="text/javascript" src="data.php"></script>
....

where data.php (.jsp / .asp / .cgi / etc.) returns ready to use
JavaScript arrays or JSON objects (see <http://www.json.org>)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top