Make reset postcode button work
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
color: var(--wc-red);
|
||||
cursor: pointer;
|
||||
|
||||
&.decline {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
filter: brightness(160%);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
document.addEventListener("click", function (event) {
|
||||
event.preventDefault();
|
||||
if (event.target.matches(".reset-postcode-show-comfirm")) {
|
||||
console.log("link1 button clicked!");
|
||||
event.preventDefault();
|
||||
document.querySelector(".bevestiging").dataset.open = true;
|
||||
}
|
||||
|
||||
if (event.target.matches(".accept")) {
|
||||
event.preventDefault();
|
||||
console.log("link2 button clicked!");
|
||||
fetch(ajax_object.ajax_url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
action: "unset_my_session",
|
||||
nonce: ajax_object.nonce, // The nonce value
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.success) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (event.target.matches(".decline")) {
|
||||
console.log("link3 button clicked!");
|
||||
event.preventDefault();
|
||||
document.querySelector(".bevestiging").dataset.open = false;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user