[Catalyst] Catalyst - any good AJAX tutes?

David Dorward david at dorward.me.uk
Sat Mar 7 08:47:40 GMT 2009


kakimoto at tpg.com.au wrote:
> hello, all :)
> 
>  thanks for the responses to help me out. I was wondering if there are
> any good tutes that can be recommended for a perl programmer to
> 
> 1) learn enough to set up the javascript itself ( be it in jQuery, dojo
> or anything you prefer)

The book JavaScript: The Good Parts  by Douglas Crockford is great for
learning the JavaScript language. Beginning JavaScript with DOM
Scripting and Ajax: From Novice to Professional by Christian Heilmann
covers a lot of non-core language things that you'll want if you are
going to use Ajax.

> 2) learn enough about how to intercept the ajax request in the
> controller

It is exactly the same as intercepting any other request. Here is a
short, non-Catalyst example:
http://github.com/dorward/simple-ajax-demo/blob/b86a9ce37f2ebed207b50cac0004ff849d544c58/webroot/demo.pl

> and send it back to the page ( ie JSON)?

There's virtually nothing to JSON - http://json.org/ - it is just a
simple data format. You can use any format you like - a simple string,
XML, whatever. JSON just happens to be simple, powerful, and easy to
parse in JavaScript.

> With AJAX,i  guess we hope to cut down on development time 

Reusing other people's code might help with this, but adding Ajax
functionality won't. It increases the amount of work as (assuming you do
things properly - with progressive enhancement) you have to create two
outputs for each activity you want to perform with Ajax.


-- 
David Dorward                               <http://dorward.me.uk/>



More information about the Catalyst mailing list