I am having a problem using the AHAH method to load data into a div tag…
I am trying to load the output from fort.php into
[code=html]<div id=”fdiv”>Loading Fortune</div>
And yet, it shows a getElementById(target) error.
Here is the Javascript I am using:
[code=html]function jah(url,target) {
// native XMLHttpRequest object
document.getElementById(target).innerHTML = ‘sending…’;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = function() {jahDone(target);};
req.open(“GET”, url, true);
req.send(null);
// IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject(“Microsoft.XMLHTTP”);
if (req) {
req.onreadystatechange = function() {jahDone(target);};
req.open(“GET”, url, true);
req.send();
}
}
setTimeout(‘jah(“fort.php?head=1”, “fdiv”)’, 15000);
}
function jahDone(target) {
// only if req is “loaded”
if (req.readyState == 4) {
// only if “OK”
if (req.status == 200) {
results = req.responseText;
document.getElementById(target).innerHTML = results;
} else {
document.getElementById(target).innerHTML=”jah error:n” +
req.statusText;
}
}
}
jah(“fort.php?head=1”, “fdiv”);
If anyone could help me, it would be FANTASTIC