in reply to call js function from CGI?

Just like a static HTML page can contain JavaScript, so can a dynamically built one.

use strict; use warnings; use CGI qw( :standard ); print( header(), start_html('A Simple Example'), qq{<p>Hey look, some HTML!</p>}, qq{<script>alert("Hey look, some JS!");</script>}, end_html(), );

Replies are listed 'Best First'.
Re^2: call js function from CGI?
by Anonymous Monk on Apr 08, 2008 at 14:44 UTC
    I tried this:
    print '<script>reload_foobar function();</script>';
    but no luck

      The code works for me in Perl:

      >perl -le "print '<script>reload_foobar function();</script>';" <script>reload_foobar function();</script>

      but this doesn't look very much like JavaScript to me:

      reload_foobar function();

      Maybe you can tell us what you want to do. Maybe you can also describe how Javascript::SpiderMonkey is overkill and how what you want can be done with less than pulling in a complete Javascript interpreter.

      Check your browser's error console. I'm sure there's an error message waiting for you there, since what you posted isn't JavaScript.