view scripts/pjx_NO_CACHE_caller.pl @ 3:2e849c856026 boosterpack

[svn r5] it works!
author robert
date Tue, 08 Sep 2009 05:55:51 -0400
parents 477258d09353
children
line wrap: on
line source
1 #!C:/strawberry/perl/bin/perl.exe
3 # 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 result
21 and return it without querying the requested URL. To avoid that, use
22 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 should
26 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 EOT
40 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