Skip to content
Advertisement

how to prevent sending data if captcha is not resolved successfully

I have an input and a google recaptcha
and need to send input value only if the captcha is solved
after page reload the value of grecaptcha.getResponse() is an empty string
when captcha is resolved by a single click – the value is a long string – differ after each page load
how to know what is the value if the captcha says – you're a robot or something like that
in other words how to cancel sending data if captcha is not solved successfully?

JavaScript

best I found is here – https://developers.google.com/recaptcha/docs/verify
and tried this:

JavaScript

any help

Advertisement

Answer

Here you have a working example in Php

JavaScript

and the Javascript

JavaScript
JavaScript

Remember that you must register your website in the google recaptcha portal

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement