in reply to Ajax/perl/javascript in perl

How does it fail for you? Is it a Javascript error? Is it a Perl error? What does the Javascript Error Console say? What does your webserver error log say?

Please post a short (20 lines) script that uses CGI::Ajax and the corresponding HTML that demonstrates the problem. My guess is that you are not exporting the Perl function.

Replies are listed 'Best First'.
Re^2: Ajax in perl
by realmonk (Initiate) on Apr 26, 2010 at 07:09 UTC
    The function works find with a plan onclick="perlfunction('string','string','results')" problem happends when i am using the setInterval function in javascript. I am not good in javascript and don't have a debugger or editor. This is causing me to find the errors myself. I belive webserver (tomcat) doesn't show the error on the client side (javascript).

      You haven't posted any code, so how are we expected to reproduce your problem?

      If you are "not good in Javascript", maybe you should learn that? This sounds a bit like "I'm not good at swimming but I like to win this Triathlon.

      The Javascript Error Console is available in every Javascript-capable browser, at least in Firefox and likely also in Internet Explorer. You will need to learn lots more about Javascript if you plan on developping an application that makes heavy use of Javascript.

      Please read the Writeup Formatting Tips to make your code render and download nicely, thanks!

        Sorry for all the mistakes. This is my first time posting a problem. Find the test code below.
        Use CGI::Ajax; Use CGI; use DBI; my $ajax = new CGI::Ajax('report' => \&report); <html> <body> <input type="button" value="submit" onclick="setInterval('report([\'ar +gs__real\',\'args__monk\'],[\'re\'])', 5000)" </body> <div id="re"><div> </html> sub report { my $input1 = shift; my $input2 = shift; $dbh=DBI->connect("DBI:mysql:$db;host=$host","$user","pass"); $re=$dbh->perpare("select * from table where firstname="$input1" and l +asname="input2"); return $re }
        This is an example of something I am trying to do. I want this Ajax function to run every 5 seconds to update my html div tag.