joney.jn has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: How to get run jquery in cgi program?
by ww (Archbishop) on Aug 17, 2011 at 12:05 UTC

    Code which appeared originally, reformated with <code>...</code tags (and some guesses about OP's indenting style):

    #! c:/perl/bin/perl.exe $cgi=new CGI; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/ +/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="/htdocs/js/jquery-1.4.1.min.js"></ +script> <style type="text/styelsheet" src="/htdocs/css/main.css"></style> <script type="text/javascript"> $(document).ready(function() { $("body").css("display", "none"); $("body").fadeIn(2000); }); </script> </head> <body onload=changed() align=left> <center> <table id=one cellspacing=0 style="/*background:#99CC66*/" + width=924> <tr class=firstrow><td id=logo align="left" style="backgroun +d-image:url($logo);background-repeat:no-repeat;"></td></tr> <tr class=secondrow> <td class=menu style="/*background-ima +ge:url(/htdocs/images/menubg.png);*/"> <div class="header"> <div class="header_resize"> <div class="clr"></div> <div class="menu_nav" id="menu_nav"> <ul> <li class="active"><a href="/anna/index.cgi"><span><span>Hom +e</span></span></a></li> <li><a href="/anna/aboutus.cgi"><span><span>About Us</span>< +/span></a></li> <li ><a href="http://localhost/index.php"><span><span>e-Lear +ning</span></span></a></li> <li><a href="/anna/contact.cgi"><span><span>Contact Us</span +></span></a></li> </ul> </div> </div> ..... ..... ....
Re: How to get run jquery in cgi program?
by Anonymous Monk on Aug 17, 2011 at 12:28 UTC
    I suggest that you put JavaScript into separate ".js" files and include them by means of an emitted <script> tag. Otherwise, put 'em in a template file. Don't muddy-up your Perl source code with them.

      The same usually holds true for embedded HTML as well.

Re: How to get run jquery in cgi program?
by Anonymous Monk on Aug 17, 2011 at 11:58 UTC

    Am trying to use jquery with cgi program but perl compiler is not recogonizing the $ symbol of jquery.

    Why would perl know how to interpret a javascript program?

    If you wish to include/inline a html document in your perl program, you have to quote it, use heredocs (single quotes are non-interpolating)

    #!/usr/bin/perl -- use strict; use warnings; use CGI; Main( @ARGV ); exit( 0 ); sub Main { my $html = <<'__THIS_IS_MY_HTML__'; ... __THIS_IS_MY_HTML__ my $q = CGI->new; print $q->header, $html; }

    See perlintro, Tutorials > CGI Programming

Re: How to get run jquery in cgi program?
by marto (Cardinal) on Aug 17, 2011 at 11:59 UTC