Loading results (via ajax) from a CGI

[email protected] Fri, 27 Nov 2009 05:58:37 -0800
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
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.

I try changing the content-type (html, text) and specifing the status  
header (200 ok) but my ajax routine receive an 0 status code. I tested  
the CGI directly via browser and it works fine

Any idea where is going this?


If this help, here is my ajax routine:

function ShowInstallInfo (int_value)
   {
   var ajax_this;
   if (window.XMLHttpRequest) { ajax_this = new XMLHttpRequest(); }
   else { ajax_this = new ActiveXObject("Microsoft.XMLHTTP"); }
   ajax_this.onreadystatechange = function ()
     { if (ajax_this.readyState==4 || ajax_this.readyState=="complete")
       { alert("Results: "+ajax_this.status+" text:"+ajax_this.responseText); }
     };
   // This URI works (test):   'http://www.hunlock.com/examples/notajax.html';
   // This URI DOES NOT works (mine):    
'http://keys.siteupsoftware.com/cgi-bin/install_verify.cgi?value='+int_value;
   var myurl = 'http://www.hunlock.com/examples/notajax.html';
   ajax_this.open("GET", myurl, true);
   ajax_this.send(null);
   }