diff --git a/app/views/module.ejs b/app/views/module.ejs index 0c2c6f4..a1f9ca5 100644 --- a/app/views/module.ejs +++ b/app/views/module.ejs @@ -4,6 +4,7 @@ +
@@ -219,7 +224,7 @@ <%= data[i].file[j] %> - Download link + <% } %> @@ -292,12 +297,13 @@ $(document).ready(function () { $(".fileName").click(function(){ data = $(this).attr('id').split("|"); + var getUrl = window.location; + path_name = getUrl.pathname.slice(0,-4)+'readlogs'; $.ajax({ type: "post", - url: "/api/readlogs", + url: path_name, data: {'file' : data[0] , 'folder' : data[1]}, success: function(response) { - console.log(response); $('.modal-title').html(data[0]); $('.modal-body').html(response.data); $('#myModal').modal('show'); @@ -310,9 +316,12 @@ $(".fileName").click(function(){ $(".delete").click(function(){ data = $(this).attr('id').split("|"); + var getUrl = window.location; + path_name = getUrl.pathname.slice(0,-4)+'deletelog'; +alert(path_name) $.ajax({ type: "post", - url: "/api/deletelog", + url: path_name, data: {'file' : data[0] , 'folder' : data[1]}, success: function(response) { console.log(response); @@ -324,12 +333,12 @@ $(".delete").click(function(){ }); }); -function downloadImage(data) +function downloadImage(data,fileName) { const base64Image = data; // Replace this with your actual Base64 image data const downloadLink = document.createElement('a'); downloadLink.href = base64Image; - downloadLink.download = 'log.txt'; // Replace with the desired file name and extension + downloadLink.download = fileName; // Replace with the desired file name and extension downloadLink.click(); }