I've been using HTML::Mason for quite a few years now. It makes developing interactive www applications just so simple. Recently I started hearing a lot of buzz about Ajax, and started doing google searches for ajax and mason. To my dismay, I found next to nothing. I wanted to find some simple examples of how to integrate HTML::Mason and Ajax. That is the itch that is hopefully scratched by the following pages.

In order to run these examples, you will have to have HTML::Mason up and running already. If you don't, then I'm sorry, these docs are not for you. You will also need Syntax::Highlight::Mason which is available on CPAN. Create a directory somewhere in your component root, and unpack these files into it. You will also have to have your web server configured so that it runs mason for any files inside this subdirectory. That should be all there is to it.

  1. Auto Complete a Text Field
  2. Drag and Drop Elements
  3. Edit a Text Field in Place
  4. Create a Link that does an Ajax Call
  5. Periodically Call the Server with Bidirectional Message Passing
  6. Watch a Form for Changes
  7. Create a Sortable List

I encountered some unexpected behaviours. When you try out Create a link that does an Ajax call, I expected it to update a specific span, but instead the page was reloaded with the result of the call. If you figure out how to avoid this, please let me know and I'll update the example.

I hope you find this useful as an example of integrating Ajax calls in a HTML::Mason environment.