package Notes; use strict; use CGI::Carp qw[fatalsToBrowser]; use CGI::Ajax; # hope it plays ok with C::A... use base 'CGI::Application'; my $pjx = CGI::Ajax->new ( 'export' => \&print_input ); sub setup { my $self = shift; $self->mode_param( "m" ); # mode param in query string $self->start_mode( "main" ); # starting run mode $self->error_mode("fatal_error"); $self->tmpl_path("tmpl/"); # other run modes $self->run_modes ( 'main' => 'main', ); } ### main page of the website ### when linking back to it, it's easiest to use ### home sub main { my $self = shift; my $q = $self->query; # the CGI object my $tmpl = $self->load_tmpl( 'main.tmpl' ); $pjx->build_html( $q, \$tmpl->output ); } sub fatal_error { my $self = shift; my $error = $@; return $error; } ## ajax functions sub print_input { my $input = shift; return ($input . " was the inputted value"); } 1; #### AJAX Test Enter something: