How to display xml content with html tags and view it as html using Jquery load -
i want display xml content html tags , view in html format via browser using jquery load.
issue: html tags displayed actual html tags (i.e. <p> or <br>
) in browser , need convert html format.
i have xml:
<?xml version="1.0" encoding="utf-8" ?> <catalog> <title>catalog 1</title> <text_area><p>this test catalog1</p><br>this second line<br>last line. <b>end</b></text_area> </catalog>
i have html, js code
<!doctype html> <html> <head><script src="https://code.jquery.com/jquery-1.10.2.js"></script></head> <body> <b>catalog</b><br> title:<div id="title"></div><br> content:<div id="text_area"></div><br> <script> var getvar = "catalog.xml"; $( "#title" ).load("catalog.xml title"); $( "#text_area" ).load("catalog.xml text_area"); </script> </body> </html>
with code, result shows:
catalog
title: catalog 1 content:<p>this test catalog1</p><br>this second line<br>last line. <b>end</b>
need convert , expected results:
catalog
title: catalog 1
content: test catalog1
this second line
last line.
end
Comments
Post a Comment