K
K
kimqar_ver2020-02-18 13:03:14
PHP
kimqar_ver, 2020-02-18 13:03:14

How to do google recaptcha validation in ajax form?

There is an ajax form, how to make it check whether the google recaptcha checkbox is clicked?

$(document).ready(function() {
    $('.form_modal').validate({
        rules: {
            modal_form_name: "required",
            modal_form_phone: "required",
            
        },
        messages: {
            modal_form_name: "Введите Ваше имя",
            modal_form_phone: "Введите Ваш телефон",
        },

        
         submitHandler: function(form, event) {
            event.preventDefault();
            var form = $('.form_modal'),
                url = form.attr('action'),
                type = form.attr('type') ? form.attr('type') : 'POST';
            $.ajax({
                type: type,
                url: url,
                data: form.serialize(),
                success: function() {
                    form.hide().parent().html('<div class="big-4">Спасибо! Ваша заявка принята. </div><br/><div class="big-4">Наши сотрудники свяжутся с Вами в ближайшее время.</div>')
                }
            });
        }
    });
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question