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/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();
                }
            });
        }

    });
});