Good afternoon, gentlemen, there is a ready-made code written in php, which displays the data in an html table:
<tbody> <tr> <?php foreach ($data as $values): ?> <?php $hyperkey = $values['list_project_id']; ?> <?php foreach ($values as $value) : ?> <td><a href="/project/<?= $hyperkey ?>"><?= $value ?></a></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> I want to update my spreadsheet when clicking a button, and AJAX is the best solution. I started like this:
function fucnSuccess(data){ $('tbody').html(data) } $(document).ready(function(){ $("#reload").click(function(){ $.ajax({ type: "GET", url: "server.php", success: fucnSuccess }) }); });` The beginning seems to be understandable, we hook onto our AJAX on the button, But what to do with php data, translate into JSON? How to implement it?
And what if you need to update the data in two pages, that is, the table is such that when I click on a record, it loads information (also from Mysql) about this record