When an AJAX query is made, a XML file is returned. Although I am able to "parse" the file, extracting the "innerHTML" (or in this case "innerXML") of an element poses a challenge.
If an XML element, such as "content", contains only text, retrieving it is simple using content.childNodes[0].nodeValue
(assuming that content refers to the XML element "content"). However, if that element contains other nested elements:
<stackoverflow reason="tribute to this page">
<content>
<div><span><p>Some more HTML elements</p></span></div>
</content>
</stackoverflow>
The task at hand is to transfer the content within the <content>
element to an existing <div>
on the webpage. How can this be accomplished?
For example:
myDiv.innerHTML = content.innerHTML;