title: reCAPTCHA with ajax validation always returns wrong even when correct
body: <p>Live example is as below: <a href="http://www.uslegalsupport.com/contact-us-new/" rel="nofollow">http://www.uslegalsupport.com/contact-us-new/</a></p>
  
  <p>Basically, when you fill out the form entering the required fields of course, if you enter a correct or incorrect captcha, it says it's invalid. I've checked everything I can think of and compared it to <a href="http://www.jquery4u.com/forms/setup-user-friendly-captcha-jqueryphp/" rel="nofollow">http://www.jquery4u.com/forms/setup-user-friendly-captcha-jqueryphp/</a> - I can't seem to figure out what it is I'm missing and/or doing wrong.</p>
  
  <p>Any help is much appreciated!</p>
  
  <p>JavaScript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  //Validate the Recaptcha' Before continuing with POST ACTION
  function validateCaptcha()
  {
      challengeField = $("input#recaptcha_challenge_field").val();
      responseField = $("input#recaptcha_response_field").val();
      var html = $.ajax({
          type: "POST",
          url: "validateform.php",
          data: "form=signup&amp;recaptcha_challenge_field=" + challengeField + "&amp;recaptcha_response_field=" + responseField,
          async: false
          }).responseText;
      if(html == "success") {
          //Add the Action to the Form
          $("form").attr("action", "/thank-you-for-contacting-us-new/"); //&lt;-- your script to process the form
          $("#submit").attr("value", "Submit");
          //Indicate a Successful Captcha
          $("#captcha-status").html("&lt;p class=\"green bold\"&gt;Success! Thanks you may now proceed.&lt;/p&gt;");
      } else {
          $("#captcha-status").html("&lt;p class=\"red bold\"&gt;The security code you entered did not match. Please try again.&lt;/p&gt;");
          Recaptcha.reload();
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>HTML Form:</p>
  
  <pre><code>&lt;form id="signup" method="post" action="javascript:validateCaptcha()"&gt;
  
  &lt;input class="contacinput" type="text" name="name222" placeholder="Name*" size="40" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="company222" placeholder="Company or Law Firm*" size="40" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="title222" placeholder="Title*" size="40" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="phone222" placeholder="Phone Number*" size="20" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="email222" placeholder="Email*" size="20" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="address222" placeholder="Street Address" size="20"&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="city222" placeholder="City" size="20"&gt;&lt;input class="contacinput" type="text" name="state222" placeholder="State" size="5"&gt;&lt;input class="contacinput" type="text" name="zip222" placeholder="Zip*" size="5" required&gt;&lt;br /&gt;
  &lt;input class="contacinput" type="text" name="subject222" placeholder="Subject*" size="40" required&gt;&lt;br /&gt;
  &lt;textarea rows="10" cols="45" class="contacinput" name="message222" placeholder="Message*" required&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
  
  &lt;/p&gt;
  
  &lt;div id="captcha-wrap"&gt;
          &lt;div id="termsckb-wrap"&gt;&lt;p class="bold"&gt;Type in the words below (separated by a space):&lt;/p&gt;&lt;/div&gt;
          &lt;?php
          require_once("recaptchalib.php");
          $publickey = "my-public-key-is-here"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
          ?&gt;
          &lt;div id="captcha-status"&gt;&lt;/div&gt;
  &lt;/div&gt;
              &lt;p style="color: red;" id="captchaStatus"&gt;&amp;nbsp;&lt;/p&gt;
  
  
  &lt;input class="wpcf7-form-control wpcf7-submit signup submitbtn" id="signupbutton" value="submit" type="submit" name="signupbutton" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>validateform.php :</p>
  
  <pre><code>&lt;?php 
  require_once("recaptchalib.php");
  
  $privatekey = "my-private-key-is-here"; //&lt;!----- your key here
  $resp = recaptcha_check_answer ($privatekey,
                                $_SERVER["REMOTE_ADDR"],
                                $_POST["recaptcha_challenge_field"],
                                $_POST["recaptcha_response_field"]);
  
  if (!$resp-&gt;is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    //die ("The reCAPTCHA wasn't entered correctly. Please go back and try it again. &lt;a href=\"javascript:history.go(-1)\"&gt;Back&lt;/a&gt;"
    //"(reCAPTCHA said: " . $resp-&gt;error . ")
      echo "fail";
  } else {
      echo "success";
  }
  
  ?&gt;
  </code></pre>