Mercurial > boosterpack
view scripts/pjx_NO_CACHE_caller.pl @ 0:477258d09353 boosterpack
[svn r1] initial import
author | robert |
---|---|
date | Sun, 30 Aug 2009 02:19:26 -0400 |
parents | |
children |
line wrap: on
line source
1 #!C:/strawberry/perl/bin/perl.exe3 # this is an script calls an external script and avoids caching:4 # NB The CGI::Ajax object must come AFTER the coderefs are declared.6 use strict;7 use CGI::Ajax;8 use CGI;10 my $q = new CGI;12 my $Show_Form = sub {13 my $html = "";14 $html .= <<EOT;15 <HTML><title>CGI::Ajax No_Cache Example</title>16 <HEAD>17 </HEAD>18 <BODY>19 <i>20 If the same URL is requested, A browser may cache the result21 and return it without querying the requested URL. To avoid that, use22 the 'NO_CACHE' keyword as a parameter in your javascript function.23 </i><br/>24 <form>25 Click the button and a perl script 'pjx_NO_CACHE_callee.pl should26 return the current time:<br/><br/>28 <input type="button" id="b1" size="6" value='This will cache (in IE)' onclick="perl_script([], ['out1']);return false"><br/>30 <input type="button" id="b2" size="6" value='This will NOT cache' onclick="perl_script(['NO_CACHE'], ['out1']);"><br/>32 New Time:<input type=text id="out1">35 </form>36 </BODY>37 </HTML>38 EOT40 return $html;41 };43 my $pjx = CGI::Ajax->new( 'perl_script' => 'pjx_NO_CACHE_callee.pl');44 $pjx->JSDEBUG(1);45 $pjx->DEBUG(1);46 print $pjx->build_html($q,$Show_Form); # this outputs the html for the page