Perl with Ajax issue

--000000000000dbf410058fefef8e
Content-Type: text/plain; charset="UTF-8"

I am making Ajax call to Perl page and try to parse data in perl page and
return results to html page
on my perl page, I have

use strict;
use warnings;
//
use JSON;
use CGI;

my $cgi = CGI->new();
my $string = $cgi->param('sform');
my $json = encode_json( [$string] );
print $cgi->header( -type => 'application/json' );
print $json;
print $string;

I am tesitng this on localhost.

I am getting no response. Should I install Perl on the server or does it
come with Apache package.



-- 
Cheers,

Matt Zand
Cell: 202-420-9192
Work: 240-200-6131
High School Technology Services <https://myhsts.org/>
DC Web Makers <https://dcwebmakers.com/>
Coding Bootcamps <https://coding-bootcamps.com/>

--000000000000dbf410058fefef8e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I am making Ajax call to Perl page and try to parse data i=
n perl page and return results to html page<div>on my perl page, I have<br>=
<div><br></div><div>use strict;<br>use warnings;<br>//<br>use JSON;<br>use =
CGI;<br><br>my $cgi =3D CGI-&gt;new();<br>my $string =3D $cgi-&gt;param(&#3=
9;sform&#39;);<br>my $json =3D encode_json( [$string] );<br>print $cgi-&gt;=
header( -type =3D&gt; &#39;application/json&#39; );<br>print $json;<br>prin=
t $string;<br><div><br></div><div>I am tesitng this on localhost.=C2=A0</di=
v><div><br></div><div>I am getting no response. Should I install Perl on th=
e server or does it come with Apache package.=C2=A0</div><div><br></div><di=
v><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr" class=3D"gmail_s=
ignature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=
=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr">=
<div><div>Cheers,<br><br>Matt Zand<br></div><div>Cell: 202-420-9192<br>Work=
: 240-200-6131</div><div><a href=3D"https://myhsts.org/" target=3D"_blank">=
High School Technology Services</a></div><div><a href=3D"https://dcwebmaker=
s.com/" target=3D"_blank">DC Web Makers</a></div><div><a href=3D"https://co=
ding-bootcamps.com/" target=3D"_blank">Coding Bootcamps</a><br></div><div><=
/div><br></div></div></div></div></div></div></div></div></div></div></div>=
</div></div></div></div>

--000000000000dbf410058fefef8e--
0
mahdiumd
8/12/2019 6:45:57 PM
perl.beginners.cgi 3839 articles. 0 followers. Follow

1 Replies
43 Views

Similar Articles

[PageSpeed] 41

--=_MailMate_61418ECA-56E8-48CC-BBDA-F45A6F344955_=
Content-Type: text/plain; format=flowed
Content-Transfer-Encoding: quoted-printable

On 12 Aug 2019, at 19:45, Matt Zand wrote:

> use CGI;

Do read [CGI: CGI.pm has been removed from the Perl core][1]

> Should I install Perl on the server or does it come with Apache =

> package.

Apache HTTPD does not include a Perl distribution although some =

third-party bundles include both Perl and Apache HTTPD.

You would also need to configure Apache so it will run the Perl program =

through the perl runtime.

> I am getting no response.

If you are getting no response at all, then your problem is unlikely to =

be related to a lack of Perl. That would cause it to return an error =

response.


[1]: =

https://metacpan.org/pod/distribution/CGI/lib/CGI.pod#CGI.pm-HAS-BEEN-REM=
OVED-FROM-THE-PERL-CORE
--=_MailMate_61418ECA-56E8-48CC-BBDA-F45A6F344955_=
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/xhtml; charset=3Dutf-8"=
>
</head>
<body>
<div style=3D"font-family:sans-serif"><div style=3D"white-space:normal">
<p dir=3D"auto">On 12 Aug 2019, at 19:45, Matt Zand wrote:</p>

</div>
<div style=3D"white-space:normal"><blockquote style=3D"border-left:2px so=
lid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir=3D"auto">u=
se CGI;</p>
</blockquote></div>
<div style=3D"white-space:normal">

<p dir=3D"auto">Do read <a href=3D"https://metacpan.org/pod/distribution/=
CGI/lib/CGI.pod#CGI.pm-HAS-BEEN-REMOVED-FROM-THE-PERL-CORE" style=3D"colo=
r:#3983C4">CGI: CGI.pm has been removed from the Perl core</a> </p>

</div>
<div style=3D"white-space:normal"><blockquote style=3D"border-left:2px so=
lid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir=3D"auto">S=
hould I install Perl on the server or does it come with Apache package.</=
p>
</blockquote></div>
<div style=3D"white-space:normal">

<p dir=3D"auto">Apache HTTPD does not include a Perl distribution althoug=
h some third-party bundles include both Perl and Apache HTTPD.</p>

<p dir=3D"auto">You would also need to configure Apache so it will run th=
e Perl program through the perl runtime.</p>

</div>
<div style=3D"white-space:normal"><blockquote style=3D"border-left:2px so=
lid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir=3D"auto">I=
 am getting no response.</p>
</blockquote></div>
<div style=3D"white-space:normal">

<p dir=3D"auto">If you are getting no response at all, then your problem =
is unlikely to be related to a lack of Perl. That would cause it to retur=
n an error response. </p>
</div>
</div>
</body>
</html>

--=_MailMate_61418ECA-56E8-48CC-BBDA-F45A6F344955_=--
0
david
8/13/2019 8:41:51 AM
Reply: