|
|
|
@ -211,10 +211,11 @@ |
|
|
|
|
<h1 class="mb-20 text-white link-title">Free Newsletter</h1> |
|
|
|
|
<p>Subscribe for our free newsletter</p> |
|
|
|
|
<div class="custom-search"> |
|
|
|
|
<input type="text" name = "email" id = "subscribe_email" class="custom-search-input" placeholder="Email address" required> |
|
|
|
|
<button class="custom-search-botton" onclick="subscribe()">Subscribe</button> |
|
|
|
|
<input type="text" name = "email" id = "subscribe_email" class="custom-search-input" placeholder="Email address" onkeyup="subscribeValidation()"> |
|
|
|
|
<button class="custom-search-botton" onclick="subscribe()" type="submit">Subscribe</button> |
|
|
|
|
</div> |
|
|
|
|
<span class="success-message" id="success-message"></span> |
|
|
|
|
<span class="success-message" id="error-message"></span> |
|
|
|
|
</div> |
|
|
|
|
<div class="col footer-socials"> |
|
|
|
|
<h1 class='text-white link-title'>Join Our Social Community</h1> |
|
|
|
@ -285,32 +286,44 @@ |
|
|
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
function subscribe(){ |
|
|
|
|
|
|
|
|
|
var email = document.getElementById('subscribe_email'); |
|
|
|
|
var successMessage = document.getElementById('success-message'); |
|
|
|
|
var errorMessage = document.getElementById('error-message') |
|
|
|
|
|
|
|
|
|
if(email.value != null){ |
|
|
|
|
function subscribeValidation(){ |
|
|
|
|
if(email.value.length == 0){ |
|
|
|
|
errorMessage.innerHTML="Please provide email address!"; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
errorMessage.innerHTML=""; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function subscribe(){ |
|
|
|
|
if(!subscribeValidation()){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
|
|
url: "/subscribe", |
|
|
|
|
type:"POST", |
|
|
|
|
data:{ |
|
|
|
|
email:email.value, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
success:function(response){ |
|
|
|
|
|
|
|
|
|
if (response) { |
|
|
|
|
|
|
|
|
|
// alert(response.success); |
|
|
|
|
$('#success-message').text(response.success); |
|
|
|
|
$('#success-message').fadeOut(5000).text(response.success); |
|
|
|
|
email.value = ''; |
|
|
|
|
console.log(response) |
|
|
|
|
// alert(response.success); |
|
|
|
|
// $("#contactForm")[0].reset(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error: function(response) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|