Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by Polyglot (Chaplain)
on Mar 21, 2018 at 03:31 UTC ( [id://1211390]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Using CGI::Ajax for multiple form buttons/divs simultaneously
in thread Using CGI::Ajax for multiple form buttons/divs simultaneously

To help me remember this myself in the future, should I seek to utilize CGI::Ajax again, I wish to make the following response to what you have mentioned above.

Everything must be executed from within the &main subroutine. Anything else will fall outside of the purview of Ajax upon callback from the client.

I had organized my code, as I usually do, by taking care of preliminaries before running the main subroutine--such as collecting my form inputs and setting up default values to certain variables. But instead of "compartmentalizing" things like this, and running them in their necessary A-B-C order, with Ajax, I have learned I must "nest" everything into the main subroutine.

It seems someone could update the Ajax explanations, which I think I have read several times without realizing this fact, with a little more clarity. The TIMTOWTDI philosophy seems rather narrowed by the use of CGI::Ajax, for the code must be structured in just the right way to make it work.

As for the "big mess of javascript," I have found CGI::Ajax far less unwieldy than jQuery and similar options which seem more popular. I'm happy with the small amount of JavaScript that the Ajax adds to the page.

Blessings,

~Polyglot~

  • Comment on Re^4: Using CGI::Ajax for multiple form buttons/divs simultaneously

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found