Hello, I have a perl cgi.pm page I made that I now want to have it display a message that something is loading and then have that message go away when it has completed without reload/refresh. I loaded CGI::Ajax, but I have no clue on how to make an CGI::Ajax page. I see that the create a $pjx object and export perl function. They then run a $pjx->build_html function in which they pass in the $cgi object and a function name to make the html page (\&Show_HTML). In my code I have it calling $cgi->header and $cgi->start_html with things I want (i.e., the style sheet to use and location of a javascript file (main.js). If I use $pjx->build_html, how do I specify my css and js files? Lastly, if you clear that up, how do I do my initial requirement? Does anybody have a short example of how to display text in the manner I need (i.e., I have an Update button that once it is clicked with display loading... that will then run a function to load stuff, and then I need the message to save complete for a few seconds and then disappear)? By the way, do I need $cgi->end_html anymore? Do I find out param values with $cgi->param, or do I use the pjx object to do this? It is confusing on how to move from CGI.pm to CGI::Ajax.

In reply to Simple CGI::Ajax by david.shapiro

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.