[Catalyst] Catalyst - any good AJAX tutes?
Neo [GC]
neo at gothic-chat.de
Fri Mar 6 10:33:06 GMT 2009
Kieren Diment schrieb:
>
> On 06/03/2009, at 8:56 PM, Chisel Wright wrote:
>
>> On Fri, Mar 06, 2009 at 04:43:36PM +1100, kakimoto at tpg.com.au wrote:
>>> I would like to use AJAX in my catalyst app. Any good references/tutes
>>> to recommend?
>>
>> It's just like using ajax anywhere else. Find a library you like, and
>> start using it.
>> View::JSON can be useful in sending responses to AJAX-y requests.
>>
>> I've settled on YUI, but a quick google will reveal many other
>> libraries. (script.aculo.us, dojo, jquery, ...)
>>
>
> I seem to recall the last time I did any ajaj-ey stuff it was to
> render a json tree to the browser using DBIx::Class::Tree and
> serialising it to JSON. The only tricky thing for me was remembering
> how to use javascript again (I don't do much js). After that it was
> just a matter of using Catalyst::View::JSON to send the tree to the
> browser. Really not much to it at all.
To anyone: Be careful when converting perl-datastructures to JSON. I
remember having a problem with boolean values, as javascript knows real
booleans while perl uses 0 and 1. "use JSON" did have some magic
settings to prevent a boolean 0/false to be sent as string "false",
which is interpreted as boolean true in javascript.
I will ask my collegue, where he has hidden his solution / the cause of
the problem (of course, if int 0 and 1 is sent, js casts int 0 to
boolean false).
More information about the Catalyst
mailing list