Could you please provide guidance on where to proceed?
There are multiple input rows, with each row containing a field with the class row_changed
If the value in the field is greater than 0, ajax will send the entire row to PHP. Each row is wrapped in a <tr></tr>
tag and given an id of <tr id='row'>
Currently, achieving this requires multiple if
statements.
I am looking for a solution to pass the corresponding row (inside <tr id='row'>
) to PHP if any of the fields with the class row_changed
have a value greater than 0.
Here is some information. Is it applicable to this scenario?
<tr id='row1'>
<td>
<input type="text" name="row1[]" id="date_day1" class="row_changed1">
</td>
...
<td>
<input type="text" name="row1[]" id="is_row_changed1" size="1">
<script>
$(".row_changed1").on("change", function () {
document.getElementById('is_row_changed1').value = 1;
});
</script>
</td>
<tr>
if ($("#is_row_changed1").val() > 0) {
$.post("_autosave_array.php", $("#row1 :input").serialize(), function (data1) {
$('#load1').html(data1);
$('#is_row_changed1').val(0)
});
var str = $("#row1 :input").serialize();
$("#load1_1").text(str);
}
if ($("#is_row_changed2").val() > 0) {
$.post("_autosave_array.php", $("#row2 :input").serialize(), function (data2) {
$('#load2').html(data2);
$('#is_row_changed2').val(0)
});
var str = $("#row2 :input").serialize();
$("#load2_1").text(str);
}