Is there any way to show without delay for the first time?
This is so I can get the value without delay for the first time and then refresh the value in the background.
<script>
function ajax()
{
var request = null;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
if(request)
{
request.open("GET", "troops.php");
request.onreadystatechange = function ()
{
document.getElementById("main").innerHTML = request.responseText;
}
}
request.send(null);
}
setInterval("ajax()",250)
</script>
<div id="main">
</div>