diff --git a/src/public/scripts/footer.js b/src/public/scripts/footer.js
new file mode 100644
index 0000000..7bdc130
--- /dev/null
+++ b/src/public/scripts/footer.js
@@ -0,0 +1,27 @@
+const factButton = document.getElementById("factButton");
+const factMenu = document.getElementById("factMenu");
+const factInput = document.getElementById("factInput");
+const factSubmitButton = document.getElementById("factSubmitButton");
+
+factButton.addEventListener("click", () => {
+ factMenu.classList.toggle("hidden");
+});
+factSubmitButton.addEventListener("click", () => {
+ fetch("/fact", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ fact: factInput.value,
+ }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ Swal.fire('Here is a fact!', data.fact, 'success');
+ })
+ .catch(error => {
+ console.error("Error fetching fact:", error);
+ Swal.fire('Error fetching fact', 'Please try again later', 'error');
+ });
+});
\ No newline at end of file
diff --git a/src/views/partials/footer.ejs b/src/views/partials/footer.ejs
index f6d1596..9f828cf 100644
--- a/src/views/partials/footer.ejs
+++ b/src/views/partials/footer.ejs
@@ -21,34 +21,6 @@
-
+