other thing. i have been trying to get param from html. but its not working

TEST.PL #!/usr/bin/perl -w print "Content-type: text/html\n\n"; print <<END_HTML; <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" /> <title>Untitled Document</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery +.min.js"></script> <script> \$(document).ready(function () { \$("#Submit").click(function(event) { Execute(); }); function Execute(){ \$.ajax({ type: 'POST', url: 'te.pl', data: { 's': '' }, success: function(res) { \$('#result').text(res.msg); }, error: function() { alert("failed"); } }); }; }); </script> </head> <body> <form method="post"> Fullname: <input type="text" name="fname"><br> <p id="result" >Name Is:</p> <input type="button" id="Submit" name="Submit" value="Submit"/> </form> </body> </html> END_HTML
TE.PL #!/usr/bin/perl -w use JSON; use CGI; my $q = new CGI; my $name = $q->param("fname"); my $json = encode_json( { msg => $name } ); print $q->header( -type => 'application/json' ),$json;

In reply to Re^5: submit data without reload by bigup401
in thread submit data without reload by bigup401

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.