diff --git a/js/pihole/footer.js b/js/pihole/footer.js index aab07d76..bf758a5f 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -9,12 +9,15 @@ $("body").on("click", function(event) { }); // Enable/Disable -$("#flip-status").on("click", () => { +$("#flip-status").on("click", (e) => { + e.preventDefault(); const btnStatus = $("#flip-status"); const status = $("#status"); + const text = btnStatus.text().trim(); - switch(btnStatus.text().trim()) { + switch(text) { case "Enable": + btnStatus.html(" Enabling..."); $.getJSON("api.php?enable", (data) => { if(data.status === "enabled") { btnStatus.html(" Disable"); @@ -23,6 +26,7 @@ $("#flip-status").on("click", () => { }); break; case "Disable": + btnStatus.html(" Disabling..."); $.getJSON("api.php?disable", (data) => { if(data.status === "disabled") { btnStatus.html(" Enable");