estimados tengo un código en php el cual genera una coordenada y la guarda en un archivo de texto, luego con ajax lo obtengo y vuelvo a guardar otro y se repite, les dejo el html y php
Código HTML:
Ver original <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
function createREQ() {
try {
req = new XMLHttpRequest(); /* p.e. Firefox */
}
catch(err1){
try {
req = new ActiveXObject('Msxml2.XMLHTTP'); /* algunas versiones IE */
}
catch (err2) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); /* algunas versiones IE */
}
catch (err3) {
req = false;
}
}
}
return req;
}
http = new createREQ();
function requestPOST(){
http.open("POST", "pos.php", true);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.onreadystatechange = getpos;
http.send("");
}
function getpos(){
if(http.readyState == 4){
if(http.status == 200){
xml = http.responseXML;
dato = xml.getElementsByTagName("pos")[0].childNodes[0].nodeValue;
document.getElementById("pos").innerHTML=dato;
}
}
}
a = setInterval(requestPOST(), 1000);
Código PHP:
Ver original<?php
$doc = "documento.txt";
$rand = "$r1,$r2";
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8" ?>
<poss>
<pos>
'.$pos.'
</pos>
</poss>';
?>
el problema es que el intervalo nunca sucede...
ayuda porfavor