Как через ajax php реализовать обновление таблицы mysql
При нажатии на td происходит редактирование таблицы, помогите с ajax как отправить на php редактированные данные. Чтобы потом с php отправить update в mysql
let td = document.querySelectorAll(".td");
for (let i = 0; i < td.length; i++) { //разобрать фор
td[i].addEventListener('click', function func() {
this.setAttribute("contenteditable", true);
});
};
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="css/main.css">
<title>Таблица принтеры</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<section>
<table class="table table-dark table-striped">
<thead class="thead-inverse">
<tr>
<th>id</th>
<th>Имя</th>
<th>Фамилия</th>
<th>Отчество</th>
<th>Кабинет</th>
<th>Модель принтера</th>
<th>Услуга</th>
<th>Инвентарный номер</th>
<th>Дата</th>
<th>Статус</th>
</tr>
<thead>
<tbody class="tbody">
<?php
$mysqli = mysqli_connect("", "", "", "printers" ) ;
$query = "SELECT * FROM Applications ";
mysqli_set_charset($mysqli, 'utf8');
$result = $mysqli->query($query);
if ($result->num_rows > 0) {
while ($row = $result-> fetch_assoc()){
echo "<tr><td>" . $row["id"] . "</td><td class='td'>" . $row["name"] . "</td><td class='td'>" . $row["surname"] . "</td><td class='td'>" . $row["middle_name"] . "</td><td class='td'>" . $row["office"] . "</td><td class='td'>" . $row["printer_model"] . "</td><td class='td'>" . $row["service"] . "</td><td class='td'>" . $row["number"] . "</td><td class='td'>" . $row["date"] . "</td><td><select ><option class='option' >" . $row["active"] . "</option </select></td><tr>";
}
}
else {
echo "Нет результатов, проверьте подключение";
}
$mysqli->close();
?>
</tbody>
</table>
</section>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="js/main.js"></script>
</body>
</html>