first I have an xml :
<app id="id-1">
<html_code>
<div id="id-1" class="portlet">
<div class="portlet-header">Links</div>
<div class="portlet-content">id-1</div>
</div>
</开发者_C百科html_code>
</app>
I want use jquery $.ajax to get the content in tags I use
$.ajax({
……
success: function (xml) {
alert($(xml).find("app[id='id-1']").find("html_code").text());
}
});
however, it only alert "links","id-1",but I want the <html_code>
's all content include <div>
tags,
so how can I achieve that use jquery ?or I should back to javascript use "getxml"……
thank you:)
You just need to use .html()
instead of .text()
to get the raw unfiltered goodness, like this:
alert($(xml).find("app[id='id-1']").find("html_code").html());
精彩评论