Left_blank
07-09-2010, 01:34 PM
I'm new to xml and I have a basic problem I'm hoping someone can help me with. Basically I have some PHP code which places some data in an xml file. I would then like to read this data using javascript and display it.
I have this piece of code which displays the data I want correctly.
xmlDoc=loadXMLDoc("data.xml");
x=xmlDoc.getElementsByTagName("result")[0];
y=x.childNodes[0];
r =y.nodeValue;
document.write(r);
The problem is that the data (r) is treated as a string when I need it in number form so I can perform arithmetic on it.
How can I accomplish this?
Thank you.
I have this piece of code which displays the data I want correctly.
xmlDoc=loadXMLDoc("data.xml");
x=xmlDoc.getElementsByTagName("result")[0];
y=x.childNodes[0];
r =y.nodeValue;
document.write(r);
The problem is that the data (r) is treated as a string when I need it in number form so I can perform arithmetic on it.
How can I accomplish this?
Thank you.