|
I'd like to load an XML/HTML fragment from the server and replace a node in the document by that fragment. That way, I could periodically refresh a specific region of the page.
Here is what I'm doing in the readyStateChange handler:
e = document.getElementById('fragment');
e.parentNode.replaceChild(req.responseXML.firstChild, e);
Unfortunately, an XML fragment that is fetched via XMLHttpRequest is not accepted as valid HTML by Gecko/Firefox: It only shows up as text-only, without any formatting. What's worse, getElementById() does not locate my fragment after it has been replaced once.
Is it possible to convert an XML node to an HTML element/node before insertion into the DOM?
Are there any good books on the matter that go well beyond this article?
Regards,
Andreas
|