Acupressure/ Acupuncture/Sujok Points:
``Please log in to use your wallet balance.
document.addEventListener("DOMContentLoaded", function () {
const diseaseDropdown = document.querySelector("#diseaseDropdown");
if (diseaseDropdown) {
diseaseDropdown.addEventListener("change", function () {
let selectedDisease = diseaseDropdown.value;
if (selectedDisease) {
console.log("Disease selected: ", selectedDisease); // Debugging
deductWalletBalance(); // Call function to deduct balance
}
});
}
function deductWalletBalance() {
fetch('/wp-admin/admin-ajax.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
'action': 'deduct_wallet_balance',
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert("10 credits deducted! Remaining balance: ₹" + data.new_balance);
location.reload(); // Refresh to update wallet balance display
} else {
alert("Error: " + data.message);
}
})
.catch(error => console.error("Error:", error));
}
});