[thelist] Appending XML object directly to XHTML

Anthony Baratta anthony at baratta.com
Wed Jun 27 17:20:41 CDT 2007


I might not be understanding your question correctly, but if the XML being returned does not need any massaging or changes and you want to drop it into your browser rendered, you can use the innerHTML method.

e.g.
    xmlString = AjaxReturnFunction();
    document.getElementById('TargetDiv').innerHTML = xmlString;

Or something close to that.

-----Original message-----
From: "Ben Glassman" bglassman at gmail.com
Date: Wed, 27 Jun 2007 12:06:50 -0700
To: "thelist at lists.evolt.org" thelist at lists.evolt.org
Subject: [thelist] Appending XML object directly to XHTML

> Hi all,
> 
> I am working on an Ajax-enabled calendar where click on a link to a php file
> with a query string containing an event id initials an ajax request that
> returns an XML document that is also valid XHTML 1.0 Strict (same as doctype
> of the document). I am trying to structure the calendar in such a way that
> the PHP file can use an HTML file as a template so you can update the HTML
> that the calendar updates by updating the template file. I was trying to
> just take the outermost div element returned in the xml file and append it
> directly to the XHTML document that makes the ajax call, but it only seems
> to work in Firefox. Anybody else every tried/experienced anything like this?
> I'm not even sure if what I'm trying to do is valid because I'm not serving
> the XHTML with the xml mimetype for known reasons that it won't render
> correctly in a lot of browsers.
> 
> A workaround I've found so far is to just loop through the xml div object
> with javascript and using the nodename creating elements and their contained
> text nodes.
> 
> Thanks,
> 
> Ben
> -- 




More information about the thelist mailing list