Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:22:19+00:00 2026-06-16T19:22:19+00:00

I am having some problems adding a reCaptcha to my jQuery AJAX form. I

  • 0

I am having some problems adding a reCaptcha to my jQuery AJAX form.

I have tried following the documentation, in particular this page, but had no luck.

  • If I use the “Challenge and Non-JavaScript API”, adding the code
    before the send button, I get no output.
  • If I try with the method
    called “AJAX API” adding a custom div inside the form, I don’t get
    anything anyway. Basically I am not able to show and then validate
    it.

This is the code that I have so far.

My form:

  <div id="contactForm"><img src="img/contact-form.png" width="250" height="365" alt="contact" /></div>
  Name: <span class="contactErrorFloat" id="err-name">Need the name</span>
  <input name="name" id="name" type="text" placeholder="Name.." />

  Email: <span class="contactErrorFloat" id="err-email">Need email</span><span class="contactErrorFloat" id="err-emailvld">Email not valid.</span>
  <input name="email" id="email" type="text" placeholder="Email.." />

  Message:
  <textarea name="message" id="message" rows="10" placeholder="Message.."></textarea>

  <button id="send">Send</button>

  <div class="contactError" id="err-form">Error during validation</div>
  <div class="contactError" id="err-timedout">Timeout</div>
  <div class="contactError" id="err-state"></div>

  <div id="ajaxsuccess">Email sent!</div>
</form>

My Script:

jQuery(document).ready(function ($) {
    $('#send').click(function(){
        $('.error').fadeOut('slow'); // Resetta i messaggi di errore, nascondendoli

        var error = false;

        var name = $('input#name').val();
        if (name == "" || name == " ") {
            $('#err-name').fadeIn('slow');
            error = true;
        }

        var email_compare = /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/;
        var email = $('input#email').val();
        if (email == "" || email == " ") {
            $('#err-email').fadeIn('slow');
            error = true;
        } else if (!email_compare.test(email)) {
            $('#err-emailvld').fadeIn('slow');
            error = true;
        }

        if (error == true) {
            $('#err-form').slideDown('slow');
            return false;
        }

        var data_string = $('#ajax-form').serialize();

        $.ajax({
            type: "POST",
            url: $('#ajax-form').attr('action'),
            data: data_string,
            timeout: 6000,
            error: function(request, error) {
                if (error == "timeout") {
                    $('#err-timedout').slideDown('slow');
                } else {
                    $('#err-state').slideDown('slow');
                    $('#err-state').html('C\'è stato un errore: ' + error + '');
                }
            },
            success: function () {
                $('ajax-form').slideUp('slow');
                $('#ajaxsuccess').slideDown('slow');
            }
        });

        return false;
    });
});

There is also a PHP file with the php function to send the email but I don’t think it’s much important actually. I would really LOVE if someone could give me any help to implement this. Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:22:21+00:00Added an answer on June 16, 2026 at 7:22 pm

    first of all you have to sign in to recaptcha. You can do this here:
    recaptcha.net

    then you can get your key. Then you embed the key into the sample code.
    Here

    <script type="text/javascript"
     src="http://www.google.com/recaptcha/api/challenge?k=**your_public_key**">
    

    and here

     <iframe src="http://www.google.com/recaptcha/api/noscript?k=**your_public_key**"
         height="300" width="500" frameborder="0"></iframe>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems adding a dropdownlist with ajax and stuff using jQuery. When
I'm having some problems with mySQL triggers. I have this working: CREATE TRIGGER `insert_trigger`
I have the following code, and am having some problems with it. Any help
I'm having some problems building an hierarchistic array structure - I have almost got
I'm adding the Roles provider to the built in AccountModel but having some problems
Hi I seem to be having some problems with Firefox adding 2 extra pixels
First time bitnami user here. I'm having some problems after installing this bitnami ami
I am having some problems. Basically I am adding images which are loaded via
I've been having some problems with using BerkeleyDB. I have multiple instances of the
I'm having some problems with a project I'm doing using Google Maps. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.