you can define it like this :
let table = $('.datatable-sales').DataTable({
processing: true,
responsive: true,
serverSide: true,
ajax: {
url: "<?php echo site_url("your url"); ?>",
cache: false,
type: "POST",
data: {
<?php echo your api; ?>,
}
}
or like this :
$.get({url: <?php echo json_encode(site_url('your api'))?>, cache: false})
hope it helps