I have a table that loads from another page by ajax, and a dynamic search field the loaded data change on update on the search field. And I have a large list of checkboxes, when I check the box and change search text the checked boxes are unchecked, how can I keep it checked ?
Checkboxes:
while($row = mysqli_fetch_array($result))
{
echo'<tr><td><label class="list-group-item">
<input name="checkbox[]" id="checkbox[]" class="form-check-input me-1" type="checkbox" value="'.$row["ID"].'"></td>
<td>
';}
Ajax:
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
$.ajax({
url:"DeleteGroup_Fetch.php",
method:"POST",
data:{query:query},
success:function(data)
{
$('#result').html(data);
}
});
}
$('#search_text').keyup(function(){
var search = $(this).val();
if(search != '')
{
load_data(search);
}
else
{
load_data();
}
});
});
</script>
`