Ajax demo - fetch XML and parse
The JS uses Ajax to get
this XML file
and parses it on client-side.
- The XML shows data divided into "continuerun" divisions with "timestep" values.
- Each timestep has data associated with it.
It does not matter what this data means.
We are just showing how to parse XML.
-
Parsing XML with JS
- The JS figures out at run-time how many timesteps there are, and sets up a menu.
- When you click on a timestep, it does not fetch the XML again.
It fetches the XML once, on page load, then parses it, and puts the data into
a global variable ("xsteps") that resides in memory.
When you click on a step,
the JS consults the variable "xsteps" for the data.
Timesteps menu
Click on a timestep to see details for that step.
Data
Timestep |
Action |
State |
Score |
|
|
|
|