homerUK
05-29-2007, 04:55 PM
hey,
this is probably an easy one, but ive only just started out using XML data. i'm for now, using a test tree of data but cannot access it using javascript... here's the data... (from PHP)
<ajax-reponse>
<response type="object">
<row>
<a>15</a>
<b>78</b>
<c>1</c>
<d>2</d>
<e>3</e>
<f>4</f>
</row>
<row>
<a>12</a>
<b>65</b>
<c>31</c>
<d>26</d>
<e>83</e>
<f>40</f>
</row>
</response>
</ajax-reponse>
the Javascript I'm using is this
var xmlDoc = t.responseXML; //coming from an ajax response
var _post = xmlDoc.getElementsByTagName("row");
for (x=0;x<_post.length;x++) {
alert(document.getElementByTagName("row").firstChild.nodeValue);
}
I've read up on the XML and from what i understand, the above code should be producting the value of the first tag in each "row" ??
not sure where I'm going wrong!
this is probably an easy one, but ive only just started out using XML data. i'm for now, using a test tree of data but cannot access it using javascript... here's the data... (from PHP)
<ajax-reponse>
<response type="object">
<row>
<a>15</a>
<b>78</b>
<c>1</c>
<d>2</d>
<e>3</e>
<f>4</f>
</row>
<row>
<a>12</a>
<b>65</b>
<c>31</c>
<d>26</d>
<e>83</e>
<f>40</f>
</row>
</response>
</ajax-reponse>
the Javascript I'm using is this
var xmlDoc = t.responseXML; //coming from an ajax response
var _post = xmlDoc.getElementsByTagName("row");
for (x=0;x<_post.length;x++) {
alert(document.getElementByTagName("row").firstChild.nodeValue);
}
I've read up on the XML and from what i understand, the above code should be producting the value of the first tag in each "row" ??
not sure where I'm going wrong!