in reply to Re: Perl's CGI.pm and Javascript's XMLHttpRequest
in thread Perl's CGI.pm and Javascript's XMLHttpRequest (SOLVED)

Straying a little more off topic...

I'll second the recommendation of using something like prototype.js for this. Your xmlHTTPRequest will look like this:

new Ajax.Request( '/url/to/post/to', { asynchronous: true, evalScripts: true, parameters: Form.serialize(this), onComplete: jsFunctionToCallBack });

If you're using Catalyst (ah, back to perl!) there's even a handy Prototype plugin to make things a little easier.

Recently, though, I've been turned onto jquery which is a little more lightweight than prototype, and much better documented. The above post would then look something like:

$.ajax( { url: '/url/to/post/to', type: 'POST', dataType: 'html', data: $('form#form_id').formSerialize(), complete: jsFunctionToCallBack } );


--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)