stephanm has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I need some help to send results from ajax requests to different divs from an external script.

My HTML 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>
If I use an internal script my perl code is:
### link js func to perl func my $cgi = new CGI(); my $pjx = new CGI::Ajax('test' => \&testAjax); ### perl func sub testAjax { return( @_ ); }
The output shows correctly as
Div1: Hello X Div2: Hello Y

If I use an external script:

### 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'));
it produces this output:
Div1: Hello XHello Y Div2: undefined
Obviously, 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.