Подключите нашего Telegram-бота для уведомлений о новых проектах
Tilda: Оповещение на email из кастомной формы Zero-блока
Разместить заказ

v
Заказчик
Отзывы фрилансеров:
+ 1
- 0
Зарегистрирован на сайте 5 лет и 3 месяца
Бюджет:
по договоренности
Необходимо дописать html скрипт Zero-блока (или показать способ), чтобы моя кастомная форма/таблица отправлялась мне на email, используя внутреннюю систему email-оповещений Tilda.
<style>
#simple-form {
display: flex;
flex-direction: column;
gap: 10px;
max-width: 300px;
margin: 0 auto;
}
#input-field {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
#submit-button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
#submit-button:hover {
background-color: #0056b3;
}
</style>
<form id="simple-form">
<input type="text" id="input-field" name="input-field" placeholder="Enter your text" required>
<button type="submit" id="submit-button">Submit</button>
</form>
<script>
document.getElementById('simple-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting the traditional way
const inputValue = document.getElementById('input-field').value;
// Replace with your API endpoint
const apiUrl = 'your-api-endpoint.com/sen...
// Send data to the API
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ text: inputValue }),
})
.then(response => response.json())
.then(data => {
alert('Email sent successfully!');
})
.catch(error => {
console.error('Error:', error);
alert('Failed to send email.');
});
});
</script>
<style>
#simple-form {
display: flex;
flex-direction: column;
gap: 10px;
max-width: 300px;
margin: 0 auto;
}
#input-field {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
#submit-button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
#submit-button:hover {
background-color: #0056b3;
}
</style>
<form id="simple-form">
<input type="text" id="input-field" name="input-field" placeholder="Enter your text" required>
<button type="submit" id="submit-button">Submit</button>
</form>
<script>
document.getElementById('simple-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting the traditional way
const inputValue = document.getElementById('input-field').value;
// Replace with your API endpoint
const apiUrl = '
// Send data to the API
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ text: inputValue }),
})
.then(response => response.json())
.then(data => {
alert('Email sent successfully!');
})
.catch(error => {
console.error('Error:', error);
alert('Failed to send email.');
});
});
</script>
Разделы:
Опубликован:
18.03.2025 | 18:48 [поднят: 18.03.2025 | 18:48]