I'm making a table in HTML which gets generated via PHP code:
<table class="table table-hover">
<thead>
<tr>
<td>#</td>
<td>name</td>
<td>specie</td>
<td>client</td>
<td>status</td>
<td>action</td>
</tr>
</thead>
<body>
<?php
foreach($sortedPatients as $patient){
echo "<tr><td>" . $patient['patient_id'] . "</td><td>" . $patient['patient_name'] . "</td>";
foreach($species as $specie){
if($specie['species_id'] == $patient['species_id']){
echo "<td>" . $specie['species_description'] . "</td>";
}
}
foreach($clients as $client){
if($client['client_id'] == $patient['client_id']){
echo "<td>" . $client['client_firstname'] . $client['client_lastname'] . "</td>";
}
}
echo "<td>" . $patient['patient_status'] . "</td><td><i class='glyphicon glyphicon-pencil icon'></i><i class='glyphicon glyphicon-trash icon'></i></td></tr>";
}
?>
</body>
</table>
This completely works but now I change the data ($sortedPatients) and the table won't change. Is there a way to update this table so it will show the new data?
I tried using jQuery to load the table from a different file and use JavaScript setInterval to do this every second. But then it didn't want to receive the data in the sub file that was loaded in the main file