Apending data to url not rendering correctlu
Apending data to url not rendering correctlu
Innocentm
Posts: 11Questions: 3Answers: 0
in DataTables
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
$(document).ready(function(){
$('#invoice-table').DataTable({
processing: true,
destroy: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>';
}
else{
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
This discussion has been closed.
Answers
You probably want to let Javascript build the URL instead of your templating engine. Try this:
Kevin