robert@0: #!C:/strawberry/perl/bin/perl.exe robert@0: robert@0: use strict; robert@0: use CGI::Ajax; robert@0: use CGI; robert@0: robert@0: my $func = sub { robert@0: my $input = shift; robert@0: my $i=6000000; robert@0: while($i--){ } robert@0: return "got input: $input " . 'done'; robert@0: }; robert@0: robert@0: robert@0: sub Show_HTML { robert@0: my $html = < robert@0: CGI::Ajax Example robert@0: robert@0: robert@0: robert@0: robert@0:
robert@0: Enter Something:  robert@0:
robert@0: Enter Something:  robert@0:
robert@0:
robert@0:
robert@0:
robert@0: robert@0:
robert@0:
robert@0:
robert@0: robert@0: robert@0: robert@0: EOT robert@0: robert@0: } robert@0: robert@0: my $cgi = new CGI(); # create a new CGI object robert@0: my $pjx = new CGI::Ajax( 'jsfunc' => $func ); robert@0: print $pjx->build_html($cgi,\&Show_HTML);