yii2-usuario icon indicating copy to clipboard operation
yii2-usuario copied to clipboard

ReCaptcha Ajax validation

Open srakl opened this issue 2 years ago • 0 comments

Hi,

How do i get the recaptcha to validate when submitting a form with ajax? this is my current jquery

<script>
                $(document).on("submit", "#<?= $model->formName() ?>", function () {
                    event.preventDefault();
                    event.stopImmediatePropagation(); 
                    var $form = $(this);
                    $.ajax({
                        "type":"POST",
                        "url":$form.attr('action'),
                        "data":$form.serialize(),
                        "dataType":"json",
                        "cache": true, 
                        "success":function(data){
                            $("#tax").html(data.tax);	
                        },                           
                    }).done(function(data) {
                        if(!data.success) {
                            $form.yiiActiveForm('updateMessages', data, true);
                        }
                    });

                    return false; // prevent default submit
                });
</script>

Also, any plans to add recaptcha V3? Thank you.

srakl avatar May 26 '23 15:05 srakl