klanga2049
02-05-2006, 08:18 PM
I am working with AJAX, well technically AHAH. My main use is getting a perl cgi script to generate some html then replace a divs innerHTML with that html. A lot of the time the status bar says transferring data from server/waiting for server after the page has loaded, or if the div is in an iframe, it will make the page look like it is still loading after the responseText has been returned. I am still not sure whether this is a result of my perl code or my AHAH function, any help would be appreciated. My function to get the responseText is as follows
function pass(param, method, target) {
var url = '/cgi-bin/perl/test/getstuff.cgi';
var http = getHTTPObject(); // We create the HTTP Object
if (method == null) {
method = "POST";
}
else if (method == "GET") {
url += "?" + param;
}
http.open(method, url, true);
http.onreadystatechange = function () {
if (http.readyState == 4){
if (target != null) {
document.getElementById(target).innerHTML = http.responseText;
}
}
}
if (method == "POST") {
http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http.send(param);
}
else {
http.send(null);
}
}
function pass(param, method, target) {
var url = '/cgi-bin/perl/test/getstuff.cgi';
var http = getHTTPObject(); // We create the HTTP Object
if (method == null) {
method = "POST";
}
else if (method == "GET") {
url += "?" + param;
}
http.open(method, url, true);
http.onreadystatechange = function () {
if (http.readyState == 4){
if (target != null) {
document.getElementById(target).innerHTML = http.responseText;
}
}
}
if (method == "POST") {
http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
http.send(param);
}
else {
http.send(null);
}
}