So im using AJAX to load my table data ... here is my ajax :
function loadSupplies(){
$.ajax({
url : '../controller.php',
data : {loadTable : 1},
success : function(data){
$('#tbodySupplies').html(data);
}
});
}
so inside my controller is this:
if(isset($_POST['loadTable'])){
$sql = $init->query("SELECT * FROM supplies");
foreach($sql as $supplies) : ?>
<tr>
<td><?= $supplies->stock_no; ?></td>
<td><?= $supplies->supplies_name; ?></td>
<td><?= ($supplies->quantity <= 5) ? "<span class='text-danger'>" . $supplies->quantity . " in Critical Level</span>" : $supplies->quantity; ?></td>
<td><?= $supplies->unit_of_measure; ?></td>
<td><?= $supplies->type; ?></td>
<td width="10">
<button type="button" class="btn btn-success" onclick="manage(<?= $supplies->id; ?>)">Manage</button>
</td>
</tr>
<?php endforeach; ?>
}
I don't seem to find an error but why is it giving me 'unexpected end of file' even though i already put the complete php tag. Please help.