Ver Mensaje Individual
  #8 (permalink)  
Antiguo 14/08/2015, 01:16
lidershinobi
 
Fecha de Ingreso: agosto-2015
Mensajes: 12
Antigüedad: 8 años, 8 meses
Puntos: 0
Respuesta: Actualizar una consulta por un tiempo

encontre este codigo y me funciona igaul jajajaj es que me obligaron a buscar ¬¬ en otro sitio

esto lo encontre y funciona bien

Codigo

/*
* Parametros mandatorios
*/
var seconds = 20; // el tiempo en que se refresca
var divid = "cualquier div id"; // el div que quieres actualizar!
var url = "directorio exacto el archivo php"; // el archivo que ira en el div

function refreshdiv(){

// The XMLHttpRequest object

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("Tu explorador no soporta AJAX.");
return false;
}
}
}

// Timestamp for preventing IE caching the GET request
var timestamp = parseInt(new Date().getTime().toString().substring(0, 10));
var nocacheurl = url+"?t="+timestamp;

// The code...

xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState== 4 && xmlHttp.readyState != null){
document.getElementById(divid).innerHTML=xmlHttp.r esponseText;
setTimeout('refreshdiv()',seconds*1000);
}
}
xmlHttp.open("GET",nocacheurl,true);
xmlHttp.send(null);
}

// Empieza la función de refrescar

window.onload = function(){
refreshdiv(); // corremos inmediatamente la funcion
}



probare ese codigo que publicaron aver cual trabaja mejor :s