Most gracious of monks.

I've written a small input form for a local charity, I decided to use CGI::Ajax as a learning experience for myself.

However, I feel ashamed and am having a complete BrainFart, and have gotten to the point of forgetting how to do the simplest. I'm making a small stupid mistake here and I can't see it.

When the user hits "submit" the fields are passed to a sub in another file, using CGI::Ajax. However, I keep getting an error stating

CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers

It is obviously telling me there's something wrong with my paramaters, however doing something as simple as this:

#!/usr/bin/perl sub insertVals { my $str="num:".scalar(@_); for(my $i=1;$i<scalar(@_);$i++) { $str=$str."<p>$_"; } return $str; }

... returns the CGI error. If I simply do this:

#!/usr/bin/perl sub insertVals { return "num:".scalar(@_); }

It displays num:10 as expected.

Lastly, here's the code that's calling the procedure:

insertVals(['pTD','pLocation','p1','p2','p3','p4','p5','pNum','pGameNo +tes','pGameId'], ['dbPostDiv'] );

I'm stuck in a loop here and need help out. I am wondering if anyone encountered this before? Should I check and see if the paramater is undefined? And, as always, if anyone knows of a better way, I'm all ears.

Thanks in advance. I shall sacrifice the wings of chickens and bottles of ale in appreciation of any help. :)

Additional thoughts... Using CGI::Ajax, how can I retreive the entire http string that's passed to the perl function ie: http://www.mysite.com/ajax.pl?param1=balh¶m2=bwagh.... etc..

Thanks again.


In reply to CGI::Ajax and passing the paramaters. by naveed010

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.