Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.