Php Ajax尝试从表中更新数据,但在其他行中不起作用

Php Ajax尝试从表中更新数据,但在其他行中不起作用,php,html,jquery,ajax,Php,Html,Jquery,Ajax,我通过ajax在表中的更改更新数据信息,但只使用第一行,其他行不起作用,这是我的ajax: $(document).ready(function(){ $('#table').on('change', 'input', function () { var test={ "test1": $("#test1").val(), "test2":$("#test

我通过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);
            }
        });
    });
});

如何更新表中的其他行?

必须指定具有唯一id的行,或者需要使用此关键字来获取特定的数据行。

此代码不更新任何内容。看,是的,我不放更新语句,但这样第二行就不会执行Ajax。我如何才能获得特定的行?您使用的是datatable还是simple table?我使用simple table请尝试此代码文档。getElementById(“table”).rows[I]。cells[j]。innerText;