NAME

HTML::Ajax - Generate HTML and Javascript for Ajax

SYNOPSIS

use HTML::Ajax;

my $ajax = HTML::Ajax->new;
print $ajax->library;
print $ajax->form_tag( $id, $url, $update );
print $ajax->observe_field( $id, $url, $frequency, $update, $param );
print $ajax->observe_form( $id, $url, $frequency, $update );
print $ajax->link_to( $url, $text, $update );
print $ajax->link_field( $id, $url, $text, $update, $param );

DESCRIPTION

Some stuff to make Ajax fun. It's just a good beginning, more little helpers will come soon.

METHODS

$ajax->library

Returns our library of Javascript functions and objects, in a script block.

$ajax->form_tag( $id, $url, $update )

Returns a opening form tag using ajax instead of POST.

id     = DOM id for form
url    = url to request
update = DOM id to change innerHTML with responseText

$ajax->observe_field( $id, $url, $frequency, $update, $param )

Observes a field and makes a request for changes.

id        = DOM id of field to observe
url       = url to request
frequency = frequency for observation (defaults to 2)
update    = DOM id to change innerHTML with responseText
param     = name of parameter for request (defaults to value)

$ajax->observe_form( $id, $url, $frequency, $update )

Observes a whole form with all fields and makes a request for changes.

id        = DOM id of form to observe
url       = url to request
frequency = frequency for observation (defaults to 2)
update    = DOM id to change innerHTML with responseText

Creates a link that makes a request when pressed.

url    = url to request
text   = link text or html
update = DOM id to change innerHTML with responseText

Creates a link that submits a field value when pressed.

id     = DOM id of field to observe
url    = url to request
text   = link text or html
update = DOM id to change innerHTML with responseText
param  = name of parameter for request (defaults to value)

$ajax->raw_library

Returns our library of Javascript functions and objects.

SEE ALSO

Catalyst::Plugin::Ajax, Catalyst.

AUTHOR

Sebastian Riedel, sri@oook.de

Based on the work of Sascha Kiefer, esskar@cpan.org

LICENSE

This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.