File: D:/HostingSpaces/SBogers79/artofeinstein.be/wwwroot/js/contactForm.js
/**
* Created by Pascal on 18/05/16.
*/
$(function () {
$('#contactForm #sendButton').click(function () {
var send = true;
var sendValue = {
name: $('#contactForm #name').val(),
email: $('#contactForm #email').val(),
phone: $('#contactForm #phone').val(),
activity: $('#contactForm #activity').val(),
date: $('#contactForm #date').val(),
extra_message: $('#contactForm #extra_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 (send) {
$.ajax({
method: "POST",
data: sendValue,
url: $('#contactForm').attr('action')
}).done(function (msg) {
console.log(msg);
if (msg != 'true') {
for (var key in msg) {
$('.form h3').after('<p class="check-alert temp show">' + msg[key] + '</p>');
}
}
else {
$('#sendButton').remove();
$('#contactForm').remove();
$('.form .thanks').show();
}
});
}
});
});