I have added recaptcha v3 on my website and works fine, but the problem is that I need two times click to submit my form. On first click its generates token and on the second its load the website. Could I just make that my one click on the button would count as two?
<script>
$(document).ready(function() {
$("#wyz_registration_form").submit(function(event) {
event.preventDefault();
var email = $('#wyz_user_email').val();
var user = $('#wyz_user_register').val();
grecaptcha.ready(function() {
grecaptcha.execute('MYKEY', {action: 'testine_forma'}).then(function(token) {
//console.log(token);
$('#wyz_registration_form').prepend('<input type="hidden" name="token" value="' + token + '">');
$('#wyz_registration_form').prepend('<input type="hidden" name="action" value="testine_forma">');
$('#wyz_registration_form').unbind('submit').submit();
});;
});
});
// $("button").click(function(){ //make my button click two times
// $(this).dblclick();
//$("#wyz_registration_form").submit();
// console.log('testas');
// });