Added a delete function

This commit is contained in:
2021-10-23 17:59:50 +03:00
parent 173ae5fcc5
commit 99acb1bd2a
3 changed files with 20 additions and 3 deletions

14
main.js
View File

@@ -1,3 +1,17 @@
$(document).on('click', 'div.dropdown-menu', function (e) {
e.stopPropagation();
});
const buttons = document.querySelectorAll('.delete-button')
buttons.forEach((button) => {
button.addEventListener("click", async function(event) {
const response = await fetch("delete.php", {
method: 'POST',
headers: {
'Accept': 'application/x-www-form-urlencoded',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `file=${event.target.dataset.file}`
});
})
});