Re: dom over rpc?

Ian Bicking <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
Mario Ruggier wrote:
> Hi,
> 
> i have just been playing with the recipe:
> http://quixote.ca/qx/XmlHttpUsingJsolait
> 
> And it works really nicely...
> 
> I would need something like this to load rather large chunks of xhtml, 
> that are only made visible when a user asks for them, thus for many page 
> loads they will never be seen. I can see how to send generic python 
> objects... however, to send such data and then "render" this data using 
> js on the client will be rather painful. Besides, the rendering code is 
> already done, in python on the server.
> 
> Does anyone know if it is possible to either send an xhtml dom object, 
> to be spliced into the page?

You can just send the HTML and innerHTML will do what you want, like:

containerElement.innerHTML = remoteResponse;

How you get remoteResponse depends on the transport (e.g., if JSON then 
you get some object back).  You could also write the Javascript on the 
server, and just eval() whatever the server responds with.

-- 
Ian Bicking  /  [email protected]  /  http://blog.ianbicking.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.