I am new to all of this. I'm so sorry this weird question.
I am planning to use Yajra Datatables Package to show some dynamic tables in Laravel. I have Laravel Mix installed. Apperantly datatables needs to js logic to work like sending/getting stuff with ajax.
In Laravel Mix Docs it says:
Similar to combining stylesheets with mix.styles(), you may also combine and minify any number of JavaScript files with the scripts() method
If i do this, will all of my pages that needs js will also include this particular Datatables logic for a particular table? Is this okay?
Ive mix installed but should i still use the "public/js" directory to include these type of scripts when they are needed?
tldr; Where should i put the js logic needed for datatables package in laravel?
Edit: Here is some example code. Where should i put this? I can just put in inside the related blade view but is it a good way of doing this?
<script>
$(document).ready( function () {
$('#MyDatatable').DataTable({
processing: true,
serverSide: true,
ajax: "{{ url('users-all') }}",
columns: [{ data: 'id', name: 'id' },
{ data: 'name', name: 'name' },
{ data: 'email', name: 'email' },
{ data: 'created_at', name: 'created_at' }]});});
</script>