Page 1 of 1

Chat application JS problems

Posted: Fri Aug 26, 2005 1:29 pm
by Todd_Z

Code: Select all

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://chatlance.com/Scripts/ConversationJS.php?rm=5 :: updateConv :: line 25"  data: no]
I'm working on a chat application similiar to scrotaye's - but mine involves password protected chatrooms, and lots of them. Anyways, in opera and ie, the application works pretty well. I'm sure it'll start getting crappy when the conversation gets bigger [each conversation has its own text file] But the problem at the moment is that in firefox i get the error above. Any ideas on how to fix that problem?

http://chatlance.com/Scripts/ConversationJS.php?rm=5:

Code: Select all

function checkKey ( evt ) {
	if ( evt.keyCode == 13 ) {
		writeToConversation( document.conv.msg.value );
		document.conv.msg.value = '';
	}
}

xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

function writeToConversation ( msg ) {
	url = "/Scripts/Conversation.php?c=5&m=" + msg;
	xmlhttp.open("GET", url,true);
	xmlhttp.send(null)
}

function updateConv ( ) {
	xmlhttp.open("GET", "/Scripts/Conversation.php?c=5",true);
	xmlhttp.onreadystatechange=function() {
		if ( xmlhttp.readyState == 4 ) {
			i = document.getElementById( 'convo' );
			i.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null)
	setTimeout( "updateConv()", 250 );
}

updateConv();