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

I have two questions about CGI::Ajax.

The documentation for CGI::Ajax gives an example of setting up a single event in a HTML page. Yet, how can I set up several? Setting up the module's instance as:

my $pjx = new CGI::Ajax('func_a' => \&func_a, 'func_b' => \&func_b );
doesn't appear to work. What I am wanting to do is dynamically fill the contents of a SELECT dropdown (requiring a database call...) depending upon the choice made is a different SELECT dropdown.

For my second question, what I have seen thus far is that text sent from the server back to the client is done in cleartext -- structuring objects in JSON format has not been required. Is this as intended?

Thanks for any insight shared.

Replies are listed 'Best First'.
Re: creating multiple events with CGI:Ajax?
by almut (Canon) on Jul 24, 2009 at 23:16 UTC
    ...doesn't appear to work

    It should work.  What exactly is happening instead? How does the (JS/HTML) code look like that is generating the events?

    BTW,

    What I am wanting to do is dynamically fill the contents of a SELECT dropdown

    there's an example pjx_dynselect.pl in the scripts subdirectory which appears to be dedicated to just that problem. Maybe it helps.