otnj2ee
05-14-2009, 01:01 AM
I called the AJAX and it returns:
"<root><option id=\"test\" value=\"abc\">XYZ</option></root>"
In the front end::
if((req.readyState == 4 ) && req.status == 200) {
var answer =req.responseXML ;
alert(answer.getElementById('test').getAttribute("value") ); //It never displayed anything
//But
alert(answer.getElementsByTagName("option")[0].getAttribute("value") );
//worked and displayed the: abc
}
--Why does getElementById not work?
Thanks
Scott
"<root><option id=\"test\" value=\"abc\">XYZ</option></root>"
In the front end::
if((req.readyState == 4 ) && req.status == 200) {
var answer =req.responseXML ;
alert(answer.getElementById('test').getAttribute("value") ); //It never displayed anything
//But
alert(answer.getElementsByTagName("option")[0].getAttribute("value") );
//worked and displayed the: abc
}
--Why does getElementById not work?
Thanks
Scott