Jump to content

firefox xmlhttprequest problem.


skein

Recommended Posts

<html>
<head>

<title>Untitled Document</title>
<script type="text/javascript">
function connect(){
	var xmlHttp;
	xmlHttp = new XMLHttpRequest();
	alert(xmlHttp);
	xmlHttp.open('GET','index.php', true);
	xmlHttp.send(null);
	if(xmlHttp.readyState==4){
		document.getElementById('test').innerHTML = xmlHttp.responseText
	}

}
</script>
</head>

<body onload="connect();">
<div id="test"></div>
</body>
</html>

EDIT:  Code tags..

replace this

      xmlHttp = new XMLHttpRequest();

with this

try { xmlHttp = new XMLHttpRequest();} 
catch(e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}
catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { alert("Something's wrong");
	return false;}	
		}		
}

yes. the funny thing is that alert(xmlHttp); works but it's stuck in state 1 (Loading). I looked on other forums for a solution for this problemm and I found that many other people have this but no proper solution was given. could it have something to do with Apache???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.