File: D:/HostingSpaces/SBogers87/basephotography.nl/wwwroot/js/form.js
/**
* Created by Pascal on 24/05/16.
*/
$(function () {
$('#contactForm .send-button').click(function () {
var send = true;
var sendValue = {
contactName: $('#contactForm #name').val(),
emailForm: $('#contactForm #email').val(),
formMessage: $('#contactForm #form_message').val(),
secretCode: 'isHuman'
};
$('.check-alert').removeClass('show');
$('.input-rows .alert').removeClass('alert');
$('.check-alert.temp').remove();
if (sendValue.name == '') {
send = false;
$('#contactForm #name').addClass('alert');
}
if (sendValue.email == '') {
send = false;
$('#contactForm #email').addClass('alert');
}
if (send) {
$.ajax({
method: "POST",
data: sendValue,
url: $('#contactForm').attr('action')
}).done(function (msg) {
if (msg != 'true') {
for (var key in msg) {
$('.contact-form h2').after('<p class="check-alert temp show">' + msg[key] + '</p>');
}
}
else {
$('#contactForm').remove();
$('.contact-form .thanks').show();
}
});
}
});
});