I hope this doesn't come through as a double post, I posted already and it hasn't shown up yet.
I have an XML document that is returned which has an element named html. Inside of that element is a block of HTML wrapped with CDATA tags. I can alert the html variable that i create and see it has all of the data inside of it. So I want to parse through and grab certain things now. I'm just trying to get the element to return it's id to me, even though I know it ... because I kept getting the following error. I still continue to get this error with the current code below. Error: Syntax error, unrecognized expression: > Code: $.ajax({ url: "http://www.mysite.com/response.xml", type: "GET", dataType: "xml", success: function (xml) { html = $.trim($(xml).find("html").text()); alert($("#mydiv", html).attr("id")); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert("textStatus: " + textStatus); alert("errorThrown: " + errorThrown); } }); XML: <?xml version="1.0" encoding="UTF-8"?> <response> <html><![CDATA[<div id="mydiv">blah blah stuff in here<img src="myimage.png"></div> ]]></html> </response>