我通过while循环循环了sql select行的输出.每行都有自己的形式.只有第一种形式有效.其他表格只是刷新页面,并显示所有结果.在表单上提交
通过AJAX update.php函数被执行.它仅在第一个输入字段起作用,并且不知道如何触发其他对象.
echo "
JS
$( document ).ready(function() {
//Async update
$(function () {
let idrow = $("#id").val();
$('#form'+idrow).on('submit', function (e) {
let updaterow = "update.php?id=";
console.log(updaterow + idrow);
e.preventDefault();
$.ajax({
type: 'post',
url: updaterow + idrow,
data: $('#form'+idrow).serialize(),
success: function () {
console.log('ura posodobljena');
//Koda za vstavljanje
console.log("Prej?nji ?as",$("#id-ura"+idrow).text());
$("#id-ura"+idrow).replaceWith( $(".cas"+idrow).val() );
console.log("Novi ?as",$(".cas"+idrow).val());
}
});
});
});
});