Server Status Auto Refresh

07/30/2011 01:15 F i n c h i#1
I have:

- index.php (my homepage)
- status.php (the code that shows the server status is inside)

I included the "status.php" in the "index.php" file, via "include" PHP-tag; I want the "status.php" file to refresh (inside the index.php) every x seconds without refreshing the whole page (index.php)

[Only registered and activated users can see links. Click Here To Register...]
07/30/2011 01:20 Spirited#2
Look up "refresh html" on Google or any other search engine.
This really isn't conquer related either...
07/30/2011 01:24 F i n c h i#3
If I add
Code:
<meta http-equiv="refresh" content="5" >
in "status.php" and I go to "index.php", the whole page (index.php) refresh, I want it just to refresh the status I included.
07/30/2011 01:32 Spirited#4
Quote:
Originally Posted by F i n c h i View Post
If I add
Code:
<meta http-equiv="refresh" content="5" >
in "status.php" and I go to "index.php", the whole page (index.php) refresh, I want it just to refresh the status I included.
You need to use it as a separate element then (such as javascript).
Again... this really isn't conquer related.
07/30/2011 02:07 .Kinshi#5
Ajax!
07/30/2011 02:13 BaussHacker#6
Quote:
Originally Posted by .Kinshi View Post
Ajax!
Right, when I was going to post it.
07/30/2011 02:15 zTek#7
Code:
function iRefresh(timeoutPeriod) {
setTimeout(load(),timeoutPeriod);
}
Code:
iRefresh(10000)
You could try that in the php

Google <3
07/30/2011 02:37 .Kinshi#8
Here's an example code with JQuery calling Ajax :D

You can change how fast it refreshes by changing the value in
Code:
window.setTimeout(update, 10000);
It should all be pretty straight forward, even if you don't know anything about HTML or JQuery.
GOOGLE
07/30/2011 02:44 F i n c h i#9
Well, thank you guys, I got it working, I've got this one and its working fine.
Request close!

Code:
<!--<meta http-equiv="refresh" content="5" >-->
<html>
<body>

<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(){
	if(xmlHttp.readyState==4){
		document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
		setTimeout('Ajax()',10000);
	}
}
xmlHttp.open("GET","status.php",true);
xmlHttp.send(null);
}

window.onload=function(){
	setTimeout('Ajax()',1);
}
</script>

<div id="ReloadThis"></div>

</body>
</html>
07/30/2011 14:08 pro4never#10
As mentioned earlier, this doesn't really belong in conquer related sections. It's a generic html/programming question and would be better suited to sections specifically relating to such things.

Glad you got your answer ^^