I
I
IgorRastarov2017-09-12 08:08:16
reCAPTCHA
IgorRastarov, 2017-09-12 08:08:16

How to validate and submit forms with Ajax if several forms have recaptcha?

Hello. I have 3 contact forms on one page, each has a recaptcha and I can't submit the form. I'm filling in the captcha, but I get an error You didn't enter the captcha. How to validate and submit forms with Ajax if several forms have recaptcha?

$("#form").on("submit", function() { 
            var form_data = $(this).serialize(); 
      var captcha = grecaptcha.getResponse();
      if (!captcha.length) {
         alert("Капча пустая");
      } else {
        alert("Сообщение отправлено");
            $.ajax({
            type: "POST",
            url: "captcha.php",
            data: form_data,
            });
    };			
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2017-09-12
@mrusklon

because we can't see the captcha.php code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question