Hey there everyone, hoping I could get a little insight on my problem.
When calling my function friend_list(), I'm getting an error that I do not understand nor know how to fix.

Here is the code..

function AsyncRequest(){
	this.check=function(){
		var xmlHttp=null;
		try{xmlHttp=new XMLHttpRequest();}
		catch(e){
			try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
		}
		return xmlHttp;
	};
	this.get=function(uri){
		if(this.transport!=null){this.transport.abort();}
		this.transport=this.check();
		this.transport.onreadystatechange=this.ready;
		this.transport.open("GET",uri,true);
		this.transport.send(null);
	};
	this.ok=false;
	this.post=function(uri,str){
		if(this.transport!=null){this.transport.abort();}
		this.transport=this.check();
		this.transport.open("POST",uri,true);
		this.transport.onreadystatechange=this.ready;
		this.transport.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		this.transport.setRequestHeader("Content-Length",str.length);
		this.transport.setRequestHeader("Connection","close");
		this.transport.send(str);
	};
}

function friend_list(){
	var e=new AsyncRequest;
	e.ready=function(){
		if(e.transport.readyState!=4)return;
		document.getElementById("search").innerHTML=e.transport.responseText;
	};
	e.get("status.php");
}
friend_list();

I'm trying to build dynamic building of ready state changes but there's an error around here

e.ready=function(){
	if(e.transport.readyState!=4)return;
		document.getElementById("search").innerHTML=e.transport.responseText;
};

Everything works fine in Firefox but NOT Internet Explorer

Cheers

Is it a requirement that you code all of the AJAX library by hand. If not you might want to take a look at jQuery. Otherwise, what is the error you're getting.

This article has been dead for over six months. Start a new discussion instead.