mirror of
https://github.com/anatolykopyl/file-directory.git
synced 2026-03-26 12:54:30 +00:00
Added a delete function
This commit is contained in:
14
main.js
14
main.js
@@ -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}`
|
||||
});
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user