in reply to Re^4: Using CGI::Ajax for multiple form buttons/divs simultaneously
in thread Using CGI::Ajax for multiple form buttons/divs simultaneously
Is there some way of connecting the AJAX to more than one subroutine, rather than having only the "&main" option?Sure, that's no problem. When you initially create the CGI::Ajax instance, you can pass in as many "js_call_name => perl_coderef" pairs as you like. e.g.,
Note that you still call build_html in the exact same way - this is set up when the CGI::Ajax object is created, not when it's used.my $pjx = CGI::Ajax->new(first => \&first_handler, second => \&second_ +handler); sub first_handler { ... } sub second_handler { ... }
|
|---|