Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hello Monks!

Back again with another problem I'm stuck on.. I couldn't find my answer or know how to narrow down my search on google to find my answer so I'm asking here again.

So I've had some help with using ajax in a .cgi code which was what I needed. But the original code was an <input> type and I wanted it to be a drop down list.

The problem is that I do not know how to squeeze the commented out for into the html where the dropdown list would be.

Here's the code

my $cgi = new CGI; my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func ); my $dirname = ''; opendir my($dh), $dirname or die "Couldn't open dir'$dirname':$!"; my @files = readdir $dh; my $files; closedir $dh; #for my $i ( 2 .. $#files ) { # print "<option value=\"$files[$i]\">$files[$i]</option>\n"; # }; sub perl_func { my $input = shift; my $output = $input . "was the input!"; return ($output); } print $pjx->build_html( $cgi, \&Show_HTML); sub Show_HTML { my $html = <<__EOI__; <!DOCTYPE html> <html> <head> <script type="text/javascript" src="\jquery.js"></scri +pt> <script type="text/javascript" src="script.js"></scrip +t> <script type="text/javascript" src="stats.js"></script +> <title> Graph </title> </head> <body> <form action=''> <select name="users" id="users" onChange="expo +rted_func( ['users'], ['files'] );"> </select> </form> <div id="files"></div> </body> </html> __EOI__ return $html;

Thanks in advance!


In reply to HTML/CGI for loop problem by Jabox

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-05-22 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?