In my Asp.net MVC application, I'm using the Jquery data table to show data. My problem is here you can see I'm used link inside data table to open the file. When the file not available in Downloads folder 404 server error shows, Instead of that I need to direct another page. How to check file available or not inside this datatable.File type was .html
<script>
$("#cribTable").DataTable({
"ajax": {
"url": "/CribManual/GetAllDownloadedCribs",
"type": "GET",
"processing": true,
"datatype": "JSON",
"serverSide": true
},
"columns": [
{
"data": "ID", "render": function (data) {
return `<button type="button" data-toggle="confirmation" data-title="Are you sure?" href='@Url.Action("DeleteCrib", "CribManual")/${data
}'" class="btn btn-danger">Delete</button>`;
},
orderable: false
},
{ "data": "CUS_NAME" },
{ "data": "CUS_NIC" },
{ "data": "STATUS" },
{ "data": "LOCATION" },
{
"data": "LOCATION", 'render': function (data, type, full, meta) {
return '<a href="/Downloads/' + data + '">Read File</a>';
}
}
]
});
</script>