Jump to content

refreshing a div with a php page included error


shadiadiph

Recommended Posts

Hi sorry i am still completely clueless about ajax I have been trying to use the following to refresh a php page i am including but it will not work any tips would be most appreciated, keeps giving me the error the data necessary to complete this operation is not yet available???

 

<script type="text/javascript">
function Ajax(){
var xmlHttp;
try{	
	xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
}catch (e){
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
	}catch (e){
	    try{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}catch (e){
			alert("No AJAX!?");
			return false;
		}
	}
}
xmlHttp.onreadystatechange=function(){
	document.getElementById('usersonline').innerHTML=xmlHttp.responseText;
	setTimeout('Ajax()',"20000");
}
xmlHttp.open("GET","online.php",true);
xmlHttp.send(null); 
}
window.onload=function(){
setTimeout('Ajax()',"20000");
}
</script>


</head>
<body>

<div id="wrapper">

<div id="headertop">
<div id="usersonline"><? include_once("online.php"); ?></div>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.