Force jQuery to accept XHTML string as XML?
- by MidnightLightning
So, as part of a baseline OpenID implementation in Javascript, I'm fetching a remote page source through AJAX, and looking for the <link rel="openid.server" href="http://www.example.com" /> tag in the head. I'm using the jQuery javascript library for the AJAX request, but am unable to parse out the link tags.
Several other online sources talk about using the usual jQuery selectors to grab tags from XML/XHTML sources, but it seems jQuery can only get content from the body of an HTML document, not the head (which is where the link tags are; $(response).find('link') returns null). So, I'd either need to get jQuery to force this document into XML mode or otherwise get at the head tags.
Is there a way to force jQuery to parse the response of an AJAX query as XML, when it's in reality XHTML? Or do I need to fall back to regular expressions to get the link tags out?