This is my perl cgi code
#!/usr/bin/perl use strict; use CGI; use CGI::Ajax; my $cgi = new CGI; my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func ); print $pjx->build_html( $cgi, \&Show_HTML); sub perl_func { my @input = @{$_[0]}; my $output = $input[0] . " is your id"; return( $output ); } sub Show_HTML { my $html= qq{ <HTML> <BODY> <table> <tr> <td>Student ID: </td> <td><input type="text" name="stu_id" id="stu_id" ></td> </tr> <tr> <td>Student Name: </td> <td> <input type="text" name="stu_name" id="stu_name"> </td> </tr> <tr> <td>Address: </td> <td><input type="text" name="addr" id ="addr"> <br></td> </tr> <tr> <td>Department: </td> <td> <select name="dept" id="dept"> <option value="IT">IT</option> <option value="CSE">CSE</option> <option value="ECE">ECE</option> <option value="EEE">EEE</option> </select></td> </tr> <tr> <td><input type="submit" value="Submit" onClick="exported_func +( ['stu_id','stu_name','addr','dept'], ['resultdiv'] ); ></td> </tr> </table> <div id="resultdiv"></div> </BODY> </HTML> }; return $html; } 1;

The above code is not work.

I want output to display in div tag . Anyone can help me??


In reply to ajax in perl cgi by chella2104@gmail.com

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.