HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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();
                }
            });
        }

    });
});