[jQuery] AJAX html fragment

[jQuery] AJAX html fragment

Hello all,
I'd like to return something like this from an ajax call:
<success>[html fragment]</success> or <errors><error>Error message</error>...</errors>
Where the html fragment is like <div id="foo"><script type="application/json">{foo: 'bar'}</script><span>Some stuff...</span></div>.
I would like to insert the html fragment into my page, but I'm having a really hard time. I think it's a content type issue. When I use text/html, this doesn't work:
if($('success', data).size > 0) { /* process success */ }
But if I use text/xml, when I insert the data into the document, it isn't processing it as html, I just get the plain text even though I can see all the html in the generated source.
Could somebody point me in the right direction? Should I just return specially formatted html like <div class="success">...</div> instead of <success>...</success> and use text/html?
Thanks,
Erik
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/