I need some help to send results from ajax requests to different divs from an external script.
My HTML code is:
If I use an internal script my perl code is:<input type='hidden' id='yyy' value='Hello Y'> <input type='hidden' id='xxx' value='Hello X'> <button id="test" type="button" onClick="test(['xxx','yyy'], ['out1', +'out2'] );">TEST</button><P> Div1: <div id='out1'>.</div><P> Div2: <div id='out2'>.</div><P>
The output shows correctly as### link js func to perl func my $cgi = new CGI(); my $pjx = new CGI::Ajax('test' => \&testAjax); ### perl func sub testAjax { return( @_ ); }
Div1: Hello X Div2: Hello Y
If I use an external script:
it produces this output:### Inside main script my $urlFunc = '/html/cgi/test.pl'; my $pjx = new CGI::Ajax('test' => $urlFunc); ### the file test.pl code: use cgi qw( :standard -debug); my $q = CGI->new; print $q->header; print ($q->param('xxx'), $q->param('yyy'));
Div1: Hello XHello Y Div2: undefinedObviously, the print statement concatenates the 2 parameters.
How can I get the external script to produce the same output as the internal function?
Anybody any ideas?
Thanks.
In reply to CGI::Ajax...sending results to different divs by stephanm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |