aurora26 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on (OT) how to call cgi script from javascript?

Replies are listed 'Best First'.
Re: (OT) how to call cgi script from javascript?
by Corion (Patriarch) on Apr 16, 2012 at 08:04 UTC

    CGI scripts respond to HTTP requests. How you submit that HTTP request does not matter, whether through Javascript or a plain HTML form.

    If you want to "call a subroutine" (in your Perl code), you will have to send a HTTP request from Javascript to your CGI, and then dispatch that request to your subroutine in Perl. This is basically "RPC over HTTP", and any dispatch table in your CGI program can convert a string to a subroutine reference.

Re: (OT) how to call cgi script from javascript?
by marto (Cardinal) on Apr 16, 2012 at 07:44 UTC
Re: (OT) how to call cgi script from javascript?
by Eliya (Vicar) on Apr 16, 2012 at 09:21 UTC

    Look into CGI::Ajax.  There are several examples in the docs.