Spaces:
Running
Running
File size: 975 Bytes
1dd38af c622f4a 1dd38af c622f4a 949d2b1 1dd38af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | document.addEventListener("DOMContentLoaded", () => {
const formContainer = document.getElementById("form-container");
// Fetch all forms from the backend
fetch('https://iacelectricals-backendrmitem.hf.space/getForms')
.then(response => response.json())
.then(forms => {
forms.forEach(form => {
const formCard = document.createElement("div");
formCard.classList.add("form-card");
formCard.innerHTML = `
<h3>${form.formName}</h3>
<p>${form.formDescription}</p>
<a href="${form.formLink}" target="_blank" class="button">Open Form</a>
`;
formContainer.appendChild(formCard);
});
})
.catch(error => {
console.error("Error fetching forms:", error);
formContainer.innerHTML = "<p>Unable to load forms. Please try again later.</p>";
});
});
|