rlm@0: #!C:/strawberry/perl/bin/perl.exe rlm@0: rlm@0: # this is an script calls an external script and avoids caching: rlm@0: # NB The CGI::Ajax object must come AFTER the coderefs are declared. rlm@0: rlm@0: use strict; rlm@0: use CGI::Ajax; rlm@0: use CGI; rlm@0: rlm@0: my $q = new CGI; rlm@0: rlm@0: my $Show_Form = sub { rlm@0: my $html = ""; rlm@0: $html .= <CGI::Ajax No_Cache Example rlm@0: rlm@0: rlm@0: rlm@0: rlm@0: If the same URL is requested, A browser may cache the result rlm@0: and return it without querying the requested URL. To avoid that, use rlm@0: the 'NO_CACHE' keyword as a parameter in your javascript function. rlm@0:
rlm@0:
rlm@0: Click the button and a perl script 'pjx_NO_CACHE_callee.pl should rlm@0: return the current time:

rlm@0: rlm@0:
rlm@0: rlm@0:
rlm@0: rlm@0: New Time: rlm@0: rlm@0: rlm@0:
rlm@0: rlm@0: rlm@0: EOT rlm@0: rlm@0: return $html; rlm@0: }; rlm@0: rlm@0: my $pjx = CGI::Ajax->new( 'perl_script' => 'pjx_NO_CACHE_callee.pl'); rlm@0: $pjx->JSDEBUG(1); rlm@0: $pjx->DEBUG(1); rlm@0: print $pjx->build_html($q,$Show_Form); # this outputs the html for the page