On 12/30/2012 08:09 AM, Gian Perrone wrote:
I'm wondering what the nicest way to achieve client-side content replacement is -
conceptually, I have a server-side function that generates a bit of XML, and on a
client-side button press, I want some the XML generated on the server-side to end up
inside a<div> without a page reload.
I managed to make this work by doing the RPC call in the event handler for the button
click, and pushing the resulting xbody fragment into a source. The<div> then
contains a<dyn ...> tag, and everything works fine.
Yes, that's the technique I'd suggest, as a literal fulfillment of your
request. In many cases, though, it would make sense for the server to
send underlying data values that are used to compute the XML client-side.
Also, for the "send XML" pattern, it would be very easy to define an
abstraction that hides the implementation details, which would probably
lead to nicer code.
However, my first attempt was to place an<active> tag with the RPC call inside
a<dyn> tag --- this appears to be disallowed (at runtime!).
Yes. The idea is that <active> code is run _immediately_, with no
blocking. Otherwise, how do we know what to display at that point in
the initial page state? An RPC will block, so it is disallowed.
No doubt some change to the language or standard library type signature
would allow compile-time detection of blocking in <active> code, but for
now it's a dynamic check.
_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur