I want to reload only the DIV from my page every 5 to 10 seconds because that's the time that the data will enter, I don`t want to reload the FULL page, just the DIV.
This is what I tried, but for some reason it messes up all my page format:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function () {
$('#blocoCorrente').load('#blocoCorrente');
}, 1000);
</script>
</p>
This is one part of my DIV:
<div class="blocoCorrente" id = "blocoCorrente">
<!-- Imprimir os valore dos sensor 1 -->
<p class="p0-blocoCorrente">Corrente 1:
<?php
$id = $_SESSION['userId'];
$dBname = "infosensor";
$conn = mysqli_connect($servername, $dBUsername, $dBPassword, $dBname);
$sql = "SELECT * FROM `$id` ORDER BY id DESC LIMIT 1;";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck > 0)
{
while ($row = mysqli_fetch_assoc($result))
{
//echo "".$row['sensor1']."A";
$ss1 = intval($row['sensor1'] * ($p = pow(10, 2))) / $p;
echo "".$ss1."A";
$s1 = $row['sensor1'];
}
}
?>
</p>