开发者

How do I parse XHTML document from Ajax request?

开发者 https://www.devze.com 2023-03-16 18:40 出处:网络
I have a XHTML document received via Ajax. How do I get content of <title> tag? I tried invoking getElementsByTagName() on XHTM开发者_开发技巧L document, but error says variable referencing XHTM

I have a XHTML document received via Ajax. How do I get content of <title> tag? I tried invoking getElementsByTagName() on XHTM开发者_开发技巧L document, but error says variable referencing XHTML document doesn't have getElementsByTagName() method.


Assuming your XHTML is valid, you should be able to use responseXML from your XMLHttpRequest to get an XMLDocument representation of your markup.

Alternatively you could try creating a div, and setting the responseText as the div's innerHTML.

0

精彩评论

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

关注公众号