开发者

Parsing XML Response after AJAX call in IE8

开发者 https://www.devze.com 2023-04-01 14:52 出处:网络
I\'m trying to parse an XML document returned from an AJAX call to a PHP script I\'ve written. In Chrome, this works:

I'm trying to parse an XML document returned from an AJAX call to a PHP script I've written. In Chrome, this works:

xmlDoc.getEle开发者_JAVA百科mentsByTagName("line")[0].attributes.getNamedItem("pdfWidth").value

where

xmlDoc
is an object created from
parser.parseFromString(xmlhttp.responseText,"text/xml");

In IE,

xmlDoc
is created by:

xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xmlhttp.responseText);

However the above 'getElementsByTagName' returns undefined. Not sure what I'm doing wrong here, can anyone assist?

Edit - think I've sussed it, but I can't answer my own question apparently..

I think I may have sussed this - the following seems to worK:

xmlDoc.getElementsByTagName("line").item(0).getAttribute("pdfWidth");

Took me an hour that, grrrr IE!


I think I may have sussed this - the following seems to worK:

xmlDoc.getElementsByTagName("line").item(0).getAttribute("pdfWidth");

Took me an hour that, grrrr IE!

0

精彩评论

暂无评论...
验证码 换一张
取 消