Hi!
I posted this on JavaScript but they didn't answer...
Here's my code, It doesn't work but it needs to load a php file every 0.5 seconds and then put it in a div called content.
I'm new to Ajax & JavaScript so it is a bunch of snippets merged together =/
Code:
function refresh()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("content").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open('GET','chat.php,true');
xmlhttp.send();
setTimeout('refresh()', 500);