selectors with xml cdata, parse html string
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.
Syntax error, unrecognized expression: >
-
$.ajax({
url: "http://www.mysite.com/response.xml",
type: "GET",
dataType: "xml",
success: function (xml) {
html = $(xml).find("html").text();
alert($("#mydiv", html).attr("id"));
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("textStatus: " + textStatus);
alert("errorThrown: " + errorThrown);
}
});