Jabox has asked for the wisdom of the Perl Monks concerning the following question:
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!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: HTML/CGI for loop problem
by blue_cowdawg (Monsignor) on Jul 14, 2014 at 15:51 UTC | |
Re: HTML/CGI for loop problem
by Anonymous Monk on Jul 14, 2014 at 19:32 UTC | |
Re: HTML/CGI for loop problem
by perlfan (Vicar) on Jul 15, 2014 at 15:45 UTC |
Back to
Seekers of Perl Wisdom