Reviews by

cpanratings
 

RSS

CGI-Ajax (0.43)

Love it. Using it extensively with FormBuilder and Template Toolkit, and the prototype / script.aculo.us libraries combination for DOM related eye candy.

With FormBuilder, simply set your jsfunc option to a scalar containing the javascript function you want called. Which, in this case, the the same function you are registering with your CGI::Ajax object. Such as:

<pre>

my $cgi = CGI->new();
$foo = "get_items(['my_value_div_id'],'returndiv')";
my $form = CGI::FormBuilder->new( #blahblah

jsfunc => $foo;

... );
sub retrieve_items {

my $item_num = shift;

my $page = "";

$page .= %items{$item_num};

# whatever, call your database, make a

# template, render a form, whatever

# just append all output to $page

return $page;
}

sub show_html {

my $page = "";

$page .= $cgi->header;

# blah blah do whatever,

# call you exported function

# just append it all to page

return $page;
}
my $pjx = CGI::Ajax->new('get_items', \&retrieve_items);
print $pjx->build_html($cgi, \&show_html);

</pre>

The documentation improvements could include updating Changes files.