Is there a way to loop through elements and pass the element value in the data: {} option of $.ajax()?
eg.
$res = pg_query($con, "select * from tbl_salary_deductions");
while($row = pg_fetch_assoc($res)) {
echo "<input type=checkbox class='dlccat' id='" . $row['dlcid']. "'> Category " . $row['dlccategory'] . "<br>";
}
creates the checkboxes. Then in the call pass only the checked ones so I can process them server side:
$.ajax({
url: 'ajax/register_driver.php',
data: {
//dlccat
$.each($(".dlccat:checked"), function() {
dlcat + $(this).id: true,
});
},
success: function () {
},
error: function () {
alert('DATA UPDATE FAILED. PLEASE TRY AGAIN!');
}
})

Need to save in the db the values of the checked items as per pic.