Manual changes saved
Browse files
script.js
CHANGED
|
@@ -61,22 +61,37 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 61 |
if (demoForm) {
|
| 62 |
demoForm.addEventListener('submit', function(e) {
|
| 63 |
e.preventDefault();
|
| 64 |
-
|
| 65 |
-
// Get form values
|
| 66 |
const name = document.getElementById('name').value;
|
| 67 |
const email = document.getElementById('email').value;
|
| 68 |
const phone = document.getElementById('phone').value;
|
| 69 |
-
|
| 70 |
-
//
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
//
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
});
|
| 79 |
}
|
|
|
|
| 80 |
// Calculator functionality
|
| 81 |
const hoursRange = document.getElementById('hours-range');
|
| 82 |
const hoursValue = document.getElementById('hours-value');
|
|
|
|
| 61 |
if (demoForm) {
|
| 62 |
demoForm.addEventListener('submit', function(e) {
|
| 63 |
e.preventDefault();
|
| 64 |
+
|
|
|
|
| 65 |
const name = document.getElementById('name').value;
|
| 66 |
const email = document.getElementById('email').value;
|
| 67 |
const phone = document.getElementById('phone').value;
|
| 68 |
+
|
| 69 |
+
// URL del webhook de Make
|
| 70 |
+
const webhookUrl = 'https://hook.eu2.make.com/k7nknc1ahgjv52a5k3xr6zye9234vn6w';
|
| 71 |
+
|
| 72 |
+
// Enviar datos al webhook
|
| 73 |
+
fetch(webhookUrl, {
|
| 74 |
+
method: 'POST',
|
| 75 |
+
headers: {
|
| 76 |
+
'Content-Type': 'application/json'
|
| 77 |
+
},
|
| 78 |
+
body: JSON.stringify({ name, email, phone })
|
| 79 |
+
})
|
| 80 |
+
.then(response => {
|
| 81 |
+
if (response.ok) {
|
| 82 |
+
alert(`¡Gracias ${name}! Hemos recibido tu solicitud de demo. Nos pondremos en contacto contigo pronto.`);
|
| 83 |
+
demoForm.reset();
|
| 84 |
+
} else {
|
| 85 |
+
alert('Hubo un problema al enviar tu solicitud. Inténtalo de nuevo.');
|
| 86 |
+
}
|
| 87 |
+
})
|
| 88 |
+
.catch(error => {
|
| 89 |
+
console.error('Error al enviar al webhook:', error);
|
| 90 |
+
alert('Error de conexión. Inténtalo más tarde.');
|
| 91 |
+
});
|
| 92 |
});
|
| 93 |
}
|
| 94 |
+
});
|
| 95 |
// Calculator functionality
|
| 96 |
const hoursRange = document.getElementById('hours-range');
|
| 97 |
const hoursValue = document.getElementById('hours-value');
|