Ver Mensaje Individual
  #17 (permalink)  
Antiguo 12/04/2014, 09:15
keko32
 
Fecha de Ingreso: marzo-2012
Mensajes: 25
Antigüedad: 12 años, 1 mes
Puntos: 1
Respuesta: Ajax php y mysql

Madre del amor hermoso.
a ver en mi archivo copio
Código PHP:
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'
            
$this->is_ajax TRUE
        else 
            
$this->is_ajax FALSE
agrego

Código PHP:
<script type="text/javascript" src="../js/foto.js"></script> 
en la copia de foto.php osea en fotojson.php le pongo la condicion de los 10 segundos.

y en foto.js

Código PHP:
(function actualiza() {
  $.
getJSON('../online/foto.php', function (response) {
    if (
response.newMail) {
      
alert(
        
"You have received a letter, good sir. " 
        
"I will have a quick lie-down and be on my way shortly."
      
);
    }
    
setTimeout(actualiza5000);
  });
}());