[jQuery] Use jQuery to initialise a variable from xml
OK, imagine I am a moron who has managed to get the following to work:
A web page that displays one of 25 different pictures depending on the
(manually declared) value of the variable 'picture'.
Now, I am getting (or wish to get) the value from the <value> element
in the following xml file (shown in all its glory):
<?xml version="1.0" encoding="UTF-8">
<value>1</value>
Now I seem to be reading the xml file into the page scripts OK but
cannot get the variable 'picture' to initialise with a value from
<value>. I am reading the file in as a DOM object using a
readXMLData() function that is called in a body div of the file
(function code is in the head).
I have tried :
var picture = 'node.firstChild.data'
var picture = xmlDoc.selectSingleNode("value").nodeValue
var picture = xmlDoc.getElementsByTagName("value")
and even
var picture = '<xsl:value-of select="value"/>
all instantiated from within the readXMLData() function and none of
which worked.
Can anyone help me? Please use baby steps and include such vital
information as where in the file entries must be.
Yours in desperation (I have wasted nearly 40 hours trying to get this
to work!)