Why JQuery code does not work when i click on button?

  jquery, laravel

What is the problem with my JQuery code when I click on the button it does not work, I searched a lot and tried many ways but my problem not solved. I used this code in other files, on there it works correctly but it not work in this file.

this my table:

<table class="table table-bordered">
          $insideOrders = AppOutsideModel::where('total_id', '=', $order->order_id)->get();
                    @foreach($insideOrders as $index => $inside)
                            <td>{{ $index + 1 }}</td>
                            <td>{{ $inside->menu->name }}</td>
                            <td>{{ $inside->menu->category->name }}</td>
                            <td>{{ $inside->order_amount }}</td>
                                   <button id="send_order" class="btn btn-primary btn-xs"
                                     order_id="{{$order->order_id}}">ارسال<i id="send_icon"></i>
                                      <button class="btn btn-success btn-xs" disabled>ارسال شده</button>


This is my js:-.

$('table tbody').on('click', 'button', function () {
        var order_id = $(this).attr("order_id");

            url: '{{route('sendOrders')}}',
            type: 'GET',
            dataType: 'json',
            data: {
                'id': order_id
            success: function (response) {
                if (response) {
                    alert('ارسال شد!');
                else {
                    alert('ارسال نشد!')

            }, error: function (err) {



Source: Laravel

Leave a Reply