开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜