js chat problem (vlt ajax ^^)

So ich schreib ja nen chat :smiley:
und da hab ich en ganz großes JS problem ?!

also hier der fehler der angezeigt wird in der FF fehler konsole

Fehler: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: http://jonasdesign.beeven.de/nChat/js/user.js :: loadData :: line 37"  data: no]



und noch mal für die chat msges


Fehler: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: http://jonasdesign.beeven.de/nChat/js/chat.js :: loadData :: line 37"  data: no]


und hier ist mal der Code von der chat.js datei

[code]//globale Instanz von XMLHttpRequest
var xmlHttp = false;
function unten(){
if(document.getElementById(‚scroll‘).checked == true){
document.getElementById(‚chat_box‘).scrollTop = document.getElementById(‚chat_box‘).scrollHeight - document.getElementById(‚chat_box‘).offsetHeight;
}
}
//XMLHttpRequest-Instanz erstellen
//… für Internet Explorer
try {
xmlHttp = new ActiveXObject(„Msxml2.XMLHTTP“);
} catch(e) {
try {
xmlHttp = new ActiveXObject(„Microsoft.XMLHTTP“);
} catch(e) {
xmlHttp = false;
}
}
//… für Mozilla, Opera, Safari usw.
if (!xmlHttp && typeof XMLHttpRequest != ‚undefined‘) {
xmlHttp = new XMLHttpRequest();
}

//aktuelle Daten laden
loadData();

//alle X Sekunden neue Daten holen (x=1)
setInterval(„loadData()“,1000);

function loadData()
{
if (xmlHttp) {
xmlHttp.open(‚GET‘, ‚getdata.php‘, true);
xmlHttp.send(null);
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
document.getElementById(‚chat_box‘).innerHTML = xmlHttp.responseText;
unten();
}
}

}
}
//---------------------------------------------

//---------------------------------------------
function saveData()
{

if (document.chat_form.chat_message.value != „“)
{
if (xmlHttp) {
xmlHttp.open(‚POST‘, ‚setdata.php‘);
xmlHttp.setRequestHeader(‚Content-Type‘, ‚application/x-www-form-urlencoded‘);
xmlHttp.send(‚message=‘+document.chat_form.chat_message.value);

}
}
else
{
window.alert(‚Keine Nachricht eingegeben‘);
}
document.chat_form.chat_message.value = ‚‘;
document.chat_form.chat_message.focus();
return false;
}[/code]

Ich vermute mal, dass das an der Art und Weise wie du versuchst die HttpRequest Instanz zu erzeugen, zusammenhäng

Ersetz mal den Entsprechenden Code mit folgenem

[CODE]
xmlHttp = makerequestobject()

function makerequestobject()
{
var resObject = null;
try {
resObject = new ActiveXObject(„Microsoft.XMLHTTP“)
}
catch(Error) {
try {
resObject = new ActiveXObject(„MSXML2.XMLHTTP“)
}
catch(Error) {
try {
resObject = new XMLHttpRequest()
}
catch(Error) {
alert („Erzeugung des XMLHttpRequest-Pbjectes ist nicht möglich“)
}
}
}
return resObject
}[/CODE]

jetzt kommt das hier :frowning:

Fehler: uncaught exception: [Exception... "Component returned failure code: 0x804b000f [nsIXMLHttpRequest.setRequestHeader]" nsresult: "0x804b000f (<unknown>)" location: "JS frame :: http://jonasdesign.beeven.de/nChat/js/chat.js :: saveData :: line 38" data: no]

edit:/

zeile 38: xmlHttp.setRequestHeader(‚Content-Type‘, ‚application/x-www-form-urlencoded‘);