CoolFace
Apppublic

iacelectricals/hrforms

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
script.js24 linesDownload Raw Back to root
1document.addEventListener("DOMContentLoaded", () => {2    const formContainer = document.getElementById("form-container");3 4    // Fetch all forms from the backend5    fetch('https://iacelectricals-backendrmitem.hf.space/getForms')6        .then(response => response.json())7        .then(forms => {8            forms.forEach(form => {9                const formCard = document.createElement("div");10                formCard.classList.add("form-card");11                formCard.innerHTML = `12                    <h3>${form.formName}</h3>13                    <p>${form.formDescription}</p>14                    <a href="${form.formLink}" target="_blank" class="button">Open Form</a>15                `;16                formContainer.appendChild(formCard);17            });18        })19        .catch(error => {20            console.error("Error fetching forms:", error);21            formContainer.innerHTML = "<p>Unable to load forms. Please try again later.</p>";22        });23});24