0

I'm trying to check compability of my Laravel 8 project, I have datatables with route

 ajax: {
                    url: "/detail/" + user_id,
                    data: function(d) {
                        d.kpi = $('#filter-kpi').val(),
                            d.search = $('input[type="search"]').val()
                    }
                },

when I acces it from artisan serve, it works pretty well (http://127.0.0.1:8000/detail/1000000004). But, when I access it using apache server in XAMPP (http://localhost/project-management-main/public/detail/1000000004), it return error Failed to load resource: the server responded with a status of 404 (Not Found)

Is something wrong in my route?

Vysco Zyza
  • 109
  • 1
  • 12

1 Answers1

0

if you js code in separate file than create an js global variable in your app layout.

<script>
  windows.base_url = "{{ url('/') }}";
</script>

Than in your js file access this

 ajax: {
             url: windows.base_url+"/detail/" + user_id,
             data: function(d) {
                   d.kpi = $('#filter-kpi').val(),
                   d.search = $('input[type="search"]').val()
               }
        },

hope this will solve your problem.

umefarooq
  • 4,540
  • 1
  • 29
  • 38