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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ezmiller

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

    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

  • VK

    #2
    Re: Event/Timing problem when loading data from xml...


    ezmiller wrote:[color=blue]
    > 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" ).[/color]

    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>)

    Comment

    Working...