PDA

View Full Version : what am I doing wrong?


sedah
08-04-2009, 07:42 PM
everytime I click on my link I keep getting the "HAHA error" did I miss something? Im a complete newb so bare with me :mrgreen:

<script language="javascript">
function ahah(url, target) {
document.getElementById(target).innerHTML = ' Fetching data...';
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
if (req != undefined) {
req.onreadystatechange = function() {ahahDone(url, target);};
req.open("GET", url, true);
req.send("");
}
}

function ahahDone(url, target) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML = req.responseText;
} else {
document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
}
}
}

function load(name, div) {
ahah(name,div);
return false;
}

</script>
</head>

<body>
<div id="episodes" ></div>
<a href="http://www.deathnoteonlinetv.com/php/?id=1" onclick="load('http://www.deathnoteonlinetv.com/php/?id=1','episodes');return false;">Link 1</a>
</body>