I Get some little errors when i use my ajax code:
Mozilla/Netscape Browsers give follow errors:
[CODE]
Error: uncaught exception: [Exception… “Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]” nsresult: “0xc1f30001 (NS_ERROR_NOT_INITIALIZED)” location: “JS frame :: http://192.168.1.15:83/scripts/chat-1.1.0.js :: chat_loadData :: line 61” data: no]
[CODE]uncaught exception: [Exception… “Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]” nsresult: “0xc1f30001 (NS_ERROR_NOT_INITIALIZED)” location: “JS frame :: javascript: eval(__firebugTemp__); :: anonymous :: line 1” data: no] Line 0
[CODE]
// globale Instanz von XMLHttpRequest
var chat_xmlHttp = false;
// XMLHttpRequest-Instanz erstellen
// … für Internet Explorer
try {
chat_xmlHttp = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch(e) {
try {
chat_xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch(e) {
chat_xmlHttp = false;
}
}
// … für Mozilla, Opera und Safari
if (!chat_xmlHttp && typeof XMLHttpRequest != ‘undefined’) {
chat_xmlHttp = new XMLHttpRequest();
}
function getchatrooms()
{
if(document.getElementById(“chat_container”)) {
//alert(document.getElementById(“chat_container”).title);
// aktuelle Daten laden
chat_room_id = document.getElementById(“chat_container”).title;
chat_loadData(chat_room_id);
//alert(chat_room_id);
}
}
/* alle 5 Sekunden neue Daten holen
–> erweitert auf alle 8 sekunden */
getchatrooms();
setInterval(“getchatrooms()”,10000);
function chat_loadData(chat_room_id)
{
/* Check: DIV element exist */
if(document.getElementById(“chat_content_”+chat_room_id)) {
if (chat_xmlHttp) {
chat_xmlHttp.open(‘GET’, ‘chat.get.php?room=’+chat_room_id, true);
chat_xmlHttp.onreadystatechange = function () {
if (chat_xmlHttp.readyState == 4) {
/*if (chat_xmlHttp.readyState) {*/
document.getElementById(“chat_content_”+chat_room_id).innerHTML = chat_xmlHttp.responseText;
} else {
/*alert (chat_xmlHttp.readyState);*/
}
};
chat_xmlHttp.send(null);
}
}
}
function chat_saveData(chat_room_id)
{
if (chat_xmlHttp) {
chat_xmlHttp.onreadystatechange = ErrorMessagesChat;
chat_xmlHttp.open(‘POST’, ‘chat.post.php?room=’+chat_room_id);
chat_xmlHttp.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
chat_xmlHttp.send(‘room=’+chat_room_id+’&cid=’+document.chatbox.current_id.value+’&uid=’+document.chatbox.user_id.value+’&chatmessage=’+document.chatbox.chatmessage.value);
} else {
alert (“Could not POST”);
}
function ErrorMessagesChat() {
if (chat_xmlHttp.readyState == 4) {
if (chat_xmlHttp.status == 200) {
chat_error = chat_xmlHttp.responseText;
document.getElementById(‘chat_error’).innerHTML = chat_error;
} else {
alert(‘There was a problem with the request.’);
}
}
}
// Message-Eingabefelder leeren und Focus setzen
document.chatbox.chatmessage.value = ”;
document.chatbox.chatmessage.focus();
}