How to use jquery get content with tags in xml -


first have 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>     </html_code> </app> 

i want use jquery $.ajax content in tags use

 $.ajax({    ……    success: function (xml) {           alert($(xml).find("app[id='id-1']").find("html_code").text());    }  });  

however, alert "links","id-1",but want <html_code>'s content include <div> tags,

so how can achieve use jquery ?or should javascript use "getxml"……

thank you:)

you need use .html() instead of .text() raw unfiltered goodness, this:

alert($(xml).find("app[id='id-1']").find("html_code").html()); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -