how to parse jquery ajax xhtml response?

Posted by steve on Stack Overflow See other posts from Stack Overflow or by steve
Published on 2010-04-13T21:28:01Z Indexed on 2010/04/13 21:33 UTC
Read the original article Hit count: 509

Sorry if this has been posted many times. But I've tried many variations and it still doesn't work. The HTML comes back from the jquery AJAX call fine and I am trying to remove the header and footers from the response using:

// none of these work for me
$("#content", data);
$("#content", $(data));
$(data).find("#content").html()

I've breakpoint the response to verify the #content exists by inspected $(data) and using alert to print out the data's text. I've also try using "body" or "a" as selectors, but it always come back as undefined.

I've read in this post that you can't pull in the full XHTML document: http://stackoverflow.com/questions/1050333/jquery-ajax-parse-response-text. But I can't find the answer's quote anymore, maybe it's outdated?

Has anyone ran into this problem?

Many thanks, Steve

© Stack Overflow or respective owner

Related posts about jquery-selectors

Related posts about jquery-ajax