in reply to Post from jQuery to Perl - can't access parameters

I suspect nothing is happening because your Perl script isn't getting called when you attempt this with jQuery. Your jQuery to deal with the submit actually isn't doing what you think it is. You need to explicity stop it from continuing as a normal form submission using preventDefault(). A full example can be found in the documentation for the post method http://api.jquery.com/jQuery.post/.

If you're using Firebug you can aid basic debugging by writing things out to the console via console.log('Something went wrong here/meaningful error message');, and making logging/errors persistant. I suspect you're just reloading the form. Further you may be interested in Using Perl, jQuery, and JSON for Web development from the tutorials section.

Update: this advice is spot on regards the printing of headers.

Replies are listed 'Best First'.
Re^2: Post from jQuery to Perl - can't access parameters
by stuckdev (Initiate) on Mar 13, 2013 at 15:09 UTC

    The perl code is definitely getting called. I've ensured that it at least creates a debugging file and spits out the values (but the values are blank).

    The debugging file is being created and the output looks like:

    The comment text is:

    ...so I know that's not the problem -- but thanks for the reply.

      Your $.post() is not submitting any data, because you're not telling it what data you want to post. (jQuery is a nice library, but it isn't psychic - you need to tell it what data to post.) Try something like:

      $.post( '/cgi-bin/hello_world.pl', $('#frm_name_1').serialize() );
      package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

        OMG!! Thank-you thank-you! I'm getting the values into the file now...something I've struggled with for weeks. Bless you.

        I have it all working now...you are the best!