Hvad betyder disse fejl meldinger i et Ajax Script
Hvad betyder disse to fejl, scriptet virker fint. Men kan se den melder fejl i Firefox's javascript konsol.Fejl: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://ejendommeisverige.dk/chatv2/chat.php :: handleText :: line 57" data: no]
Kildefil: http://xxxxxxx.dk/chatv2/chat.php
Linje: 57
Linje 57: if(http2.status == 200) {
Fejl: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: http://xxxxxxxx.dk/chatv2/chat.php :: getText :: line 44" data: no]
linje 44: timeoutId = setTimeout("main()", 1000);
Hele scriptet:
<script language="JavaScript" type="text/javascript">
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
}
catch(err1) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (err2) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (err3) {
req = false;
}
}
}
return req;
}
var http = getXMLHTTPRequest();
var http2 = getXMLHTTPRequest();
function sendText() {
if(document.getElementById("tekst").value.length != 0) {
if(timeoutId)clearTimeout(timeoutId);timeoutId=0;
var modurl = "send.php?text="+document.getElementById("tekst").value+"&rand="+parseInt(Math.random()*999999999999999);
http2.open("GET", modurl, true);
http2.onreadystatechange = handleText2;
http2.send(null);
document.getElementById("tekst").value = ""
timeoutId = setTimeout("main()", 1000);
}
}
function getText() {
var modurl = "get.php?rand="+parseInt(Math.random()*999999999999999);
http.open("GET", modurl, true);
http.onreadystatechange = handleText;
http.send(null);
}
function handleText2() {
if (http2.readyState == 4) {
if(http2.status == 200) {
//alert(http2.responseText);
}
}
}
function handleText() {
if (http.readyState == 4) {
if(http.status == 200) {
document.getElementById("beskeder").innerHTML = http.responseText+document.getElementById("beskeder").innerHTML;
}
}
}
var timeoutId = 0;
function main() {
getText();
timeoutId = setTimeout("main()", 2000);
}
</script>