<section class="section section--issuesthemes" style="padding: 2rem 0 !important;">
<div class="container-fluid">
<div class="row">
<div class="col-xl-11 col-lg-11 col-md-11 col-sm-12 m-auto">
<div class="row">
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-6">
<h5 style="font-weight: bold;">{{ 'mailing.mailtext'|trans }}</h5>
</div>
<div class="col-xl-5 col-lg-5 col-md-5 col-sm-6">
<div class="input-group mb-3" style="justify-content: center;align-items: center;height: 100%;">
<input type="email" name="email" class="form-control" placeholder="{{ 'mailing.placeholder'|trans }}" style="
border-right: 0px;border-radius: 25px 0px 0px 25px;height: 40px;font-size: 14px;" id="email">
<button class="btn btn-warning px-4" onclick="mail_subscribe()" onsubmit="return validateRegisterForm()" type="submit" style="height: 40px;border-radius: 25px 25px 25px 25px;font-size: 14px;position: relative;left: -15px;">{{ 'mailing.mailbutton'|trans }}</button>
</div>
</div>
{#<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6">
<ul class="subc_ul">
<li>
<a href="#">
<i class="fa-brands fa-facebook"></i>
</a>
</li>
<li>
<a href="#">
<i class="fa-brands fa-twitter"></i>
</a>
</li>
<li>
<a href="#">
<i class="fa-brands fa-pinterest-p"></i>
</a>
</li>
<li>
<a href="#">
<i class="fa-brands fa-instagram"></i>
</a>
</li>
</ul>
</div>#}
</div>
</div>
</div>
</div>
</section>
<script>
function mail_subscribe() {
if (validateRegisterForm()) {
const email = document.getElementById('email').value;
// alert(email);
$.ajax({
url: '{{ path('mail_save') }}',
type: 'POST',
data: JSON.stringify({ email : email }),
contentType: 'application/json',
success: function(data) {
if (data.success == true) {
alert(data.message);
$('#email').val('');
} else{
alert(data.message);
$('#email').val('');
}
}
});
}
}
function validateRegisterForm() {
const email = document.getElementById('email').value;
if (!validateEmail(email)) {
alert('Please enter a valid email address.');
return false;
}
return true;
}
function validateEmail(email) {
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
return re.test(String(email).toLowerCase());
}
</script>