durusmail: quixote-users: dom over rpc?
dom over rpc?
2005-07-03
2005-07-05
2005-07-05
2005-07-05
dom over rpc?
Mario Ruggier
2005-07-05
On Jul 5, 2005, at 5:12 PM, Ian Bicking wrote:

> 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;

Thanks, Ian, for the reply...

I was under the impression that innerHTML was non-standard? IE only...

If this is guaranteed to work on the newer generation of browsers, then
it would be a nice acceptable shortcut for the cases I describe above,
i.e. when the required html rendering is non-trivial.

> 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.

Thanks for the mention of JSON... http://json-rpc.org/
Was not aware of it. Do you suggest this over xml-rpc?

mario

reply