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/SBogers10/immoginis.komma.pro/wwwroot/js/contactForm.js
/**
 * Created by Pascal on 13/04/16.
 */
$(function () {


    $('.contact-form #sendButton').click(function () {
        var send = true;


        var sendValue = {
            name: $('#contactForm #name').val(),
            sur_name: $('#contactForm #sur_name').val(),
            email: $('#contactForm #email').val(),
            phone: $('#contactForm #phone').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 (sendValue.sur_name == '') {
            send = false;
            $('#contactForm #sur_name').addClass('alert');
        }
        if (sendValue.email == '') {
            send = false;
            $('#contactForm #email').addClass('alert');
        }
        if (sendValue.phone == '') {
            send = false;
            $('#contactForm #phone').addClass('alert');
        }

        if (sendValue.extra_message == '') {
            send = false;
            $('#contactForm #extra_message').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) {
                        $('#contactForm .form h2').after('<p class="check-alert temp show">' + msg[key] + '</p>');
                    }
                }
                else {
                    $('#sendButton').remove();
                    $('#contactForm').remove();
                    $('.thanks').show();
                }
            });
        }

    });
});