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

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