So close now (see 'Using AJAX with C::A' for gory details). I can now get AJAX output from the following code (adapted from CGI::Ajax example script pjx_nobuild.pl), but unfortunately I also get the headers printed along with the AJAX output:

sub display_form {
  my $self = shift;
  my $cgi  = $self->query();
                
  my $pjx = new CGI::Ajax( validate_nhsno => \&validate_nhsno );
  $pjx->cgi( $cgi ); # this is required but inserts new header!!     
                
  $pjx->JSDEBUG(1);
  my $ajax_js = $pjx->show_javascript();

  $self->tt_params(ajax_js => $ajax_js);

  return $cgi->param('fname') ? $pjx->handle_request()
  : $self->tt_process('nhs_no.tt2');
}

I read somewhere about removing headers with $self->header_type('none'), but that only generates a 'Bad header' 500 error. I assume the problem is because CGI::Application handles header generation, and this conflicts with CGI::Ajax handling of headers? I hope the solution to this is simple.
--
Richard Jones
Leeds, UK
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to