Populate a javascript array with XML data

billw17's Avatar

billw17

01 Feb, 2011 03:26 PM

I would like to know how to populate a javascript array:

var finalistData = new Array(

new Array ( "pict_large", "author", "first", "Grand Prize Winner", "full-name", "Country", "age", "sponsor", "theme", "year won"),
.... };

Each field is contained within cascade and writes to the xml file. What I need to know is how do I get all 20 rows or so to properly populate my javascript array.

Any thoughts?

  1. 1 Posted by Ross on 08 Mar, 2011 06:12 PM

    Ross's Avatar

    Bill,

    If the javascript is part of an HTML file, you can generate the Array data using xsl:for-each or a Velocity #foreach statement. Cascade cannot publish a .js file directly, so if you need to load the data from the client side, I'd suggest publishing an XML file that you load using AJAX.

  2. Tim closed this discussion on 21 Jun, 2011 03:35 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac