<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.submit_button').click(function(){
var email = jQuery('.email_value').val();
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
if( !isEmail(email)) {
alert('Please Enter A valid Email Address. ');
}else {
if(jQuery('.email_value').val() != ''){
$.ajax({
type: "POST",
url: "https://stg.app2food.com/newsletter/v1/insertNewsletter",
data: {store_id: 1022, email : email},
success: function(data)
{
console.log(data);
alert('Your Email ID is Sucessfully Edit.');
location.reload();
}
});
}else{
alert('Please Enter Your Email Address');
}
}
});
});
</script>
No comments:
Post a Comment