Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Using CGI::Ajax for multiple form buttons/divs simultaneously

by dsheroh (Monsignor)
on Mar 20, 2018 at 08:32 UTC ( [id://1211279]=note: print w/replies, xml ) Need Help??


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.,
my $pjx = CGI::Ajax->new(first => \&first_handler, second => \&second_ +handler); sub first_handler { ... } sub second_handler { ... }
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1211279]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found