const scriptURL = 'https://script.google.com/macros/s/AKfycby-3vo7veUYx-igLxNL57J259omvFJqG-LG3OKwRNigZDzreq2alGO7wLjy1eyASWVf/exec' const form = document.getElementById('ticket-form'); form.addEventListener('submit', e => { e.preventDefault(); // Empêche le rechargement par défaut du formulaire fetch(scriptURL, { method: 'POST', body: new FormData(form) }) .then(response => response.json()) .then(data => { if (data.result === 'success') { alert("Les données ont été mises à jour avec succès !"); window.location.href = "affichage.html"; } else { alert("Une erreur est survenue : " + data.error); } }) .catch(error => console.error('Erreur !', error.message)); }); // La page est terminée