Jump to content

Pass HTML in XML with Ajax


xander85

Recommended Posts

Hi,

 

I'm using a simple Ajax script that grabs some MySQL data, create an XML tag, and displays in a <span> tag. This works fine. However, when I try to pass html code it doesn't work. So I tried the <![CDATA[ tag and when I look at the raw XML output it looks fine:

 

<LaborValue>
<type>addons</type>
<addons>Add-ons WTD: $600 </addons>
<variance>(33.3% <img src='images/up-arrow.png'>)</variance>
</LaborValue>

 

However, the image doesn't actual show up on my page. Anything after the <![CDATA[ tag actually shows up. Do I need to send the HTML in a different way to actually display the image?

 

The following is the ajax code that actual displays the xml on the page:

 

document.getElementById("lcvalue_addons").innerHTML=xmlDoc.getElementsByTagName("addons")[0].childNodes[0].nodeValue
	+ xmlDoc.getElementsByTagName("variance")[0].childNodes[0].nodeValue;

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/196439-pass-html-in-xml-with-ajax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.