I want to get to do a div
recharge only when it finds a modification in the database I currently have this so, if you can help me I would appreciate it is for a shift system that I am doing:
<?php
require_once("../../db/db.php");
$result = $mysqli->query("SELECT * FROM 'turnos' ORDER by 'turno' desc limit 1" );
$row = $result->fetch_row();
echo '<script type="text/javascript">
swal({ title: "siguiente turno : '.$row[0].'",
text: "Se envio correctamente",
type: "success",
showConfirmButton: false,
timer: 2000
});
</script>';
?>
this is the ajax:
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
setInterval(function() {
$('#turnos').load('./ajax/turnos.php');// Selector de la div y el fichero a refrescar
}, 1000); // Temporizador que ejecuta el refresco cada 1 segundos
</script>
div:
<div id="turnos"></div>