Mercurial > rlmcintyre
comparison BoosterPack/scripts/.svn/text-base/pjx_NO_CACHE_caller.pl.svn-base @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0d795f02a8bb |
---|---|
1 #!C:/strawberry/perl/bin/perl.exe | |
2 | |
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. | |
5 | |
6 use strict; | |
7 use CGI::Ajax; | |
8 use CGI; | |
9 | |
10 my $q = new CGI; | |
11 | |
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/> | |
27 | |
28 <input type="button" id="b1" size="6" value='This will cache (in IE)' onclick="perl_script([], ['out1']);return false"><br/> | |
29 | |
30 <input type="button" id="b2" size="6" value='This will NOT cache' onclick="perl_script(['NO_CACHE'], ['out1']);"><br/> | |
31 | |
32 New Time:<input type=text id="out1"> | |
33 | |
34 | |
35 </form> | |
36 </BODY> | |
37 </HTML> | |
38 EOT | |
39 | |
40 return $html; | |
41 }; | |
42 | |
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 |