I don't know how to pass the selected values of the checkboxes. Any help or suggestions will be a big help for me.
As of now here is my code I am stuck in passing the values of the checkboxes
index.php
<table>
<?php
foreach($response as $item){
echo '<tr><td><input type="checkbox" value="' .$item['id']. '"></td><td>' . $item['name'] . '</td></tr>';
}
?>
</table>
<button type="button" class="btnadd">AddSelected</button>
<script type="text/javascript">
$(function() {
$('.btnadd').click(function() {
$.ajax({
url: 'process.php',
type: 'post',
data: { }, // what should I put here to pass the value of checked checkboxes
success: function(data) {}
});
});
});
</script>
process.php
<?php
$array_ids = $_POST['ids']; // this will retrieve the id's
?>