T
T
Timofey Barinov2017-01-31 18:48:10
Google
Timofey Barinov, 2017-01-31 18:48:10

How to prevent google recapcha from sending data?

PaP7Ot5.gif

This alert is definitely not mine.

I am using ajax to make a request. But our favorite captcha is that when the button is clicked, I submit the form. And sends ... But she will not succeed. Muhahahaha

Can I find out where and how to write code so that she does not do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Timofey Barinov, 2017-01-31
@hol

Choto did not understand how it happened
Before:

$( "#button" ).click(function() {
        
        var email = $('#email').val();
        var password = $('#password').val();
        var cp = $('#g-recaptcha-response').val()

        if (cp.length == 0){
            $('.capcha-form-group').addClass('has-error');
            $('.capcha-help-block').text('Поставьте галочку на против поля "Я не робот" ').fadeIn("fast");
            

        }
        else{
            $('.capcha-help-block').fadeOut("fast").text('').removeClass('has-error');
        }
        $.post(
            './app/register.php', {
            act: 'register',
            email: email,
            password: password,
            'g-recaptcha-response': cp,
            },
            CheckStatus
        )
        event.preventDefault();
        
    });

Already working:
$( "#button" ).click(function() {
        
        var email = $('#email').val();
        var password = $('#password').val();
        var cp = $('#g-recaptcha-response').val()

        if (cp.length == 0){
            $('.capcha-form-group').addClass('has-error');
            $('.capcha-help-block').text('Поставьте галочку на против поля "Я не робот" ').fadeIn("fast");
            

        }
        else{
            $('.capcha-help-block').fadeOut("fast").text('').removeClass('has-error');
        
        $.post(
            './app/register.php', {
            act: 'register',
            email: email,
            password: password,
            'g-recaptcha-response': cp,
            },
            CheckStatus
        )
        
        }
        event.preventDefault();
    });

M
Michael, 2017-01-31
@FFxSquall

Well, this is not a rally of psychics. It's hard to say without code, but I think you should handle the form submit event or a click on the submit button in js, after interrupting the default execution with preventDefault()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question