From 074be3fac7327453cde29c78c615a7cf681d572f Mon Sep 17 00:00:00 2001 From: Verox001 Date: Tue, 30 Jan 2024 10:53:21 +0100 Subject: [PATCH] Added dynamic update of progress bar --- templates/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index e767f0c..a2acf8a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -109,7 +109,7 @@
-
+
@@ -135,6 +135,11 @@ }).then(function (response) { // Handle the success response if needed console.log(response.data); + + // Set the percentage of the habit. percentage received as integer + var percentage = response.data.percentage; + var progressBar = document.getElementById("progress-bar-" + habitId); + progressBar.style.width = percentage + "%"; }).catch(function (error) { // Handle the error if needed console.error('Error:', error);