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(actualiza, 5000);
});
}());