Welcome coleb1115,

I am not an expert nor have I used Ajax, but I do use javascript with HTML to validate and populate form fields to be forwarded to Perl via cgi. I believe Ajax is used for continuous communication with a cgi program/script.

What you want can be done with javascript, by using the 'onClick' in the HTML. For example the following HTML will call a javascript subroutine called 'checkInfo' when the 'Login' button is clicked.

<INPUT type=submit value=Login name='ULogin' onClick="return checkInfo +();" />

The 'checkInfo' subroutine should set the fields in the Form for submission to the web server.

But, I think you could get what you wanted easier with just a drop down box with the info in table 1, that sends to your Perl script the single item selected, and then to generate a new response HTML document with the related contents of table 2 as another drop down box. (google 'select' for examples).

Whatever your solution, it will take some time before you understand the full picture, but once you understand the relationships, it will be fun to expand and innovate.

Good Luck...Ed

"Well done is better than well said." - Benjamin Franklin


In reply to Re: How to store the value of a Javascript function as a Perl variable by flexvault
in thread How to store the value of a Javascript function as a Perl variable by coleb1115

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.