Código Javascript:
Ver original
var seconds = 1; var divid = "room"; var url = "/maps/map_<?echo $_GET['map']; ?>.php"; var pos = "posicion.php"; function refreshdiv(){ var xmlHttp; try{ xmlHttp=new XMLHttpRequest(); } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Tu explorador no soporta AJAX."); return false; } } } fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)) } var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; var nocachepos = pos+"?t="+timestamp; xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('room').innerHTML=xmlHttp.responseText; document.getElementById('pos').innerHTML=xmlHttp.responseText; setTimeout('refreshdiv()',seconds*1000); } } xmlHttp.open("GET",nocacheurl,true); xmlHttp.open("GET",nocachepos,true); xmlHttp.send(null); } window.onload = function startrefresh(){ setTimeout('refreshdiv()',seconds*1000); } refreshdiv();