There are two objectives that I want, 1st is to hide the URL when mouse hover (Success). 2nd is to download the file when <a>
is clicked.
Current problem is when I click at the <a>
tag, an error appear.
What I have tried as below:
- console when click at Download
- At Inspect > Element:
Code:
$('#myTable').DataTable({
...
columns: [
{ data : "filename",
render: function (data){
var test = 'uploads/upload_file/'+filename;
console.log(test); // I got uploads/upload_file/TEST 1.pdf
return "<a href='javascript:void(0)' onclick='location.href="+test+"'>Download</a>"
}
},
],
});