How do I parse XHTML document from Ajax request?
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.
精彩评论