innerHTML and CDATA
I am using ajax to update HTML of a div . THe ajax call returns a xml structure like:
<response>
<reponse-html><![CDATA[$HTML]]</response-html>
</response>
Where $HTML is the html that i need to set for the div.
On the javascript side I do:
var elHtml = xmlRoot.getElementsByTagName( 'RESPONSE-HTML' );
var elCData = elHtml[ 0 ].firstChild;
strHtml = elCData.data;
//also tried strHtml = elCData.nodeValue;
document.getElementById( 'my_div' ).innerHTML = strHtml;
The problem is the div displays raw HTML , rather then parsed html. By raw html I mean it displays strHtml as text with all the tags and stuff. I am using firefox.
What am I doing wrong here?
I have tried sending entity encoding too, it's still the same result.
Correction: xmlRoot is root node i.e. <Response>

