I have the following:
$('#search').on('keyup',function(){
var value = $(this).val();
$.ajax({
type : 'POST',
url : '{{ route("search") }}',
dataType: 'json',
data: {
'_token' : '{{ csrf_token() }}',
value : value,
company_id : '{{ request()->company_id }}'
},
success: function(res){
var tableRow = '';
$('#table-content').html('');
$.each(res, function(index, value){
tableRow = `<tr>
<td hidden> ${value.id} </td>
<td> ${value.employee_number} </td>
<td> ${value.name} </td>
<td> ${value.code } - ${value.description } </td>
<td> ${value.quantity } </td>
<td> ${value.novelty.unit } </td>
<td> ${value.date} </td>
<td> ${value.informed}</td>
</tr>`
$('#table-content').append(tableRow);
});
}
});
Its working OK but the date its printing like this: Image
And I want the date to print in d-m-Y format. I've been playing a lot with different options but none of them worked for me.
EDIT: I'dont know if it changes something but that template literal its inside the success function of an ajax request.