Re: Loading results (via ajax) from a CGI

[email protected] (Rene Schickbauer) Tue, 01 Dec 2009 13:01:21 +0100
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
[email protected] wrote:
> I have a CGI (made with cgi.pm) that receive a parameters, check against 
> a DB and returns a text with "not found" or "OK found" message. Pretty 
> simple.
> 
> In other site, i have an ajax routine that sends the parameters (via 
> get) and is expected to capture the resulting page, but is not working. 
> If I try with a static page, there is not problem, only when calling 
> that CGI.

The may be a problem with your headers. What i mean is, is the browser 
(wrongly) caching the page you request?

Try setting the correct headers. Also, you might add an ever-changing 
dummy value to your request to trick the browser into thinking this is a 
new, non-cached page.

You have
var myurl = 'http://server/script.cgi?value='+int_value;

change to:

var myurl = 'http://server/script.cgi?value='+int_value + '&dummyvalue=' 
+ now.getTime();

LG
Rene