Laravel Route in JavaScript Function

  javascript, laravel, routes

I have the below section of my js file but instead of hard code http://127.0.0.1:8000/Edit/Fee/Category/1. I need to Pass laravel route like this

{{route('Edit.Fee.Category',$Category->id)}}
var initTable5 = function() {
        var table = $('#kt_datatable5');

        // begin first table
        table.DataTable({
            scrollY: '450vh',
            scrollX: true,
            scrollCollapse: true,
            columnDefs: [{
                    targets: -1,
                    title: 'Actions',
                    orderable: false,
                    width: '125px',
                    render: function(data, type, full, meta) {
                        return '
                            
                            <a href="http://127.0.0.1:8000/Edit/Fee/Category/1" class="btn btn-hover-bg-primary btn-text-primary btn-hover-text-white border-0 font-weight-bold mr-2">Click To Pay</a>
                            
                        ';
                    },
                },
            ],
        });
    };

Source: Ask Javascript Questions

LEAVE A COMMENT