OnTheWater

Daytona Beach Things to Do, Hotels, Restaurants & Events


 

<![CDATA[// <![CDATA[ require(['jquery', 'domReady!'], function ($) { $('.button_popup').unbind('click').bind('click', function (event) { $('.mce_inline_error_popup').remove(); if (event) { event.preventDefault(); } if (validatepopupform()) { registerpopuppage($('#mc-embedded-subscribe-form')); } }); $('.mc-field-group input').on('focus', function() { $(this).closest('.mc-field-group').addClass('mc-field-group-focused'); }) $('.mc-field-group input').on('blur', function() { if($(this).val().length === 0) { $(this).closest('.mc-field-group').removeClass('mc-field-group-focused'); } }) }); function validatepopupform() { var valcheck = true; var regex = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; var emailcheck = regex.test($('#mce-EMAIL_popup').val()); // $('.required_popup').each(function () { // if ($(this).val() == '') { // valcheck = false; // } // }) $('.error_msg_popup').html(''); $('#mc_message_popup').html(''); //if(!emailcheck){$('#mce-responses').append(“Please enter a valid email address!”);} $(‘#mc-embedded-subscribe-form’).find(‘.required_popup’).each(function () { if ($(this).val() == ”) { if ($(this).attr(‘id’) == ‘mce-EMAIL_popup’) { if (!emailcheck) { $(this).after(‘Invalid Email Address.]]>’); } } else { $(this).after(‘

This field is required.

‘);
}
valcheck = false;
}
});
if (emailcheck && valcheck) { return true; } else { return false; }
}
function registerpopuppage(form) {
$.ajax({
type: form.attr(‘method’),
url: form.attr(‘action’),
data: form.serialize(),
cache: false,
dataType: ‘jsonp’,
contentType: “application/json; charset=utf-8″,
error: function (err) { $(‘.error_msg_popup’).html(”); $(‘#mc_embed_signup_popup’).append(“Could not register you. Please try again later.”) }, success: function (data) { if (data.result != “success”) { $(‘#mc_message_popup’).html(data.msg).show(); } else { gtmDataLayer.push({ ‘event’: ‘registrationComplete’, ‘form’: ‘popup’, ‘type’: ‘enter-to-win’ }); //$(‘#mc_embed_signup_popup form’).css(‘display’, ‘none’); $(‘#mc-embedded-subscribe-form’).html(‘

Thanks for signing up!

‘);
}
}
});
}// ]]>


Read more from this Story