Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReCaptcha Ajax validation #520

Open
srakl opened this issue May 26, 2023 · 0 comments
Open

ReCaptcha Ajax validation #520

srakl opened this issue May 26, 2023 · 0 comments

Comments

@srakl
Copy link

srakl commented May 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant