Dear Monks,
I am new to Ajax and perl (ie. CGI::Ajax)
I have my sub routine running sucessfully however, I need this to be ran multipule times without realoading the entire page. I have tried using javascript as followed.
#!/usr/bin/perl
use CGI;
use CGI::Carp qw( fatalsToBrowser );
use CGI::Ajax;
my $cgi = new CGI;
my $ajax = new CGI::Ajax('report' => \&report);
print $ajax->build_html($cgi, \&main);
sub main
{
$html<<HTML_MAIN;
<html>
<body>
<input type="button" id="test" value="submit" onclick="setInterval
+('report([\'args__real\',\'args__monk\'],[\'report\'])', 5000)"
<div id="report"></div>
</body>
</html>
HTML_MAIN
return $html;
}
sub report
{
$input1=shift;
$input2=shift;
$result=$input1.$input2;
return $result;
}
This is not working any ideas how to rerun my function every 5 seconds??
Please note that
onclick="report(['args__real','args__monk'],['report'])"
will print out the correct values. P.S. I am running this on tomcat"
please ask for clarification!
Thanks,
realmonk