Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: Post from jQuery to Perl - can't access parameters

by stuckdev (Initiate)
on Mar 13, 2013 at 15:28 UTC ( #1023232=note: print w/replies, xml ) Need Help??

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

Thanks. I've tried putting in your code. I have two issues (thus far). I'm getting the error:

Can't locate in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at line 8. BEGIN failed--compilation aborted at line 8.

on the server. (I'm hosting from 2mhost, so I have no idea what this all means) Do they even have JSON?

The other issue, is that my jquery post is directly in my HTML page, not within a function on a PERL page -- so I'm having a hard time extrapolating your code and putting it into straight HTML format because I'm not exactly what you're doing with the whole J. stuff.

  • Comment on Re^2: Post from jQuery to Perl - can't access parameters

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

    As marto said, you need to have JSON installed. You could ask 2mhost to install it for you, or try to install it locally (if you have that capability). It's not a complete requirement, but JSON ("Javascript Object Notation") is a wonderful means of simplifying how data is serialized for passing between client and server.

    As for your HTML page, if it's separate from your CGI, you can just put everything printed out by subroutine "print_html() into the html page, except for the "Content-type:  text/html" (which will be printed for you automatically by the server, since it's in HTML.

    You would then change $url in the function ajax_text(), in this line:

    url: "$url",

    to be whatever the name of your actual CGI/Perl script was instead.

    However, please note that you will still need the headers printed from your server-side Perl/CGI script; eg.:

    print "Content-type: application/json\n\n";
    If you forget that, you'll get something like this error (from my /var/log/httpd/error_log file):
    [Wed Mar 13 11:41:37 2013] [error] [client] Premature en +d of script headers: 1023196.cgi, referer: +96.cgi

    Does that help you get further?

    say  substr+lc crypt(qw $i3 SI$),4,5
Re^3: Post from jQuery to Perl - can't access parameters
by marto (Archbishop) on Mar 13, 2013 at 15:31 UTC

    This means your host don't have JSON instaled, depending on your hosting deal you may be able to install modules easily, or it could be something they have to do for you. This is not a Core module. Also 5.8.8 is a fairly old verison of Perl. See also here and here.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023232]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-10-23 19:04 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (125 votes). Check out past polls.