I'm trying to develop a small AJAX program.
XML I get from the server in responseXML.
<?xml version="1.0"?>
<serverResponse><resultaat>1</resultaat></serverResponse&开发者_如何学JAVAgt;
If I try to retrieve the "resultaat" node and its content using this code :
var serverResponse = mailObject.responseXML;
var resultaatXML = serverResponse.getElementsByTagName("resultaat");
alert(resultaatXML[0].childNodes[0].nodeValue);
Firefox alerts 1 And Internet Explorer alerts 'undefined'.
I'm really stuck at this. Can someone help?
Thx
Loading that XML into MSXML the code works fine. Try adding:-
alert(serverResponse.xml);
to see exactly what IE thinks is contained in the XML Document.
Check out this question. Basically, IE requires doesn't automatically parse the XML, you have to explicitly tell it to. See this article for more.
精彩评论