how so that when searching for the check remains and is not lost

how so that when searching for the check remains and is not lost

I want when I search, the check isn't lost, and it's still there, but right now I can't find a way out, how do I check it while still searching or filtering data?
please, help me!
my jquery
fetch_customer_data();
function fetch_customer_data(query = ''){
customer = [];
$. ajax({
url : '{{ url("user/search_customer_2") }}',
method : 'GET',
data : {query : query},
dataType : 'json',
success: function(data){
$( '#message'). html(data.search_customer);
}
});
}
$(document). on( 'keyup', '#search', function() {
var query = $(this). val();
fetch_customer_data(query);
})

my controller :
public function search_customer( Request $request){
if( $request-> ajax()){
$output = '';
$query = $request-> get( 'query');
if( $query != ''){
$get_customer = DB:: table( 'tabel_master_customer')
-> where([
[ 'deleted_at', NULL],
[ 'kode_mitra', 'BMM'],
[ 'nama_customer', 'LIKE', '%'. $query. '%']
])
-> get();
} else{
$get_customer = DB:: table( 'tabel_master_customer')
-> where([
[ 'deleted_at', NULL],
[ 'kode_mitra', 'BMM'],
])
-> get();
}
if( count( $get_customer) > 0){
foreach( $get_customer as $gc){
$output .= '<input type="checkbox" class="form-control" name="customer[]" value="'. $gc-> kode_customer. '">'. $gc-> nama_customer. '';
}
} else{
$output .= 'data not found';
}
$data = [
'search_customer' => $output
];
return response()-> json( $data);
}
}

my view :
<form action= "{{ url('inspector_save') }}" method= "POST">
@csrf
<input type= "text" id= "search" name= "search" placeholder= "search">
<div id= "message"></div>
<button type= "submit">SAVE DATA</button>
</form>