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~


In reply to Re^4: Using CGI::Ajax for multiple form buttons/divs simultaneously by Polyglot
in thread Using CGI::Ajax for multiple form buttons/divs simultaneously by Polyglot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.