Apending data to url not rendering correctlu

Apending data to url not rendering correctlu

InnocentmInnocentm Posts: 11Questions: 3Answers: 0

I am trying to append data to my url in datatables but it does not seem to render correctly, the data am appending is a url to a file. Is there anything am not doing right?

Here is my code

        processing: true,
        ajax:'{!! url('account/allinvoices') !!}',
        columns: [
            {data: 'order_number', name: 'order_number'},
            {data: "invoice_number",render: function ( data, type, row ) {
                    if (data !='') {
                        return '<a href="{{asset('+data+')}}">View Invoice</a>';
                            return data;
            {data: 'action', name: 'action', orderable: false, searchable: false}    

When the link is clicked it simply displays the string +data+ in the address bar instead of the required url


  • kthorngrenkthorngren Posts: 18,572Questions: 26Answers: 4,409

    You probably want to let Javascript build the URL instead of your templating engine. Try this:

    return '<a href="'+data+'">View Invoice</a>';


This discussion has been closed.