【发布时间】:2021-06-11 01:53:27
【问题描述】:
我通过 ajax 更新表中的数据信息,但只使用第一行,其他行不起作用,这是我的 ajax:
$(document).ready(function(){
$('#table').on('change', 'input', function () {
var test={
"test1": $("#test1").val(),
"test2":$("#test2").val()
}
$.ajax({
method: "POST",
url: "data.php",
data: alta,
async:true,
cache:false,
success : function(response){
if(response=="1"){
alert("done");
}
else{
alert("sad");
}
},
error : function(error) {
alert(error);
}
});
});
});
如何更新表格中的其他行?
【问题讨论】:
-
此代码不会更新任何内容。见minimal reproducible example
-
是的,我没有放更新语句,但是这样第二行就不会执行 Ajax