PHP Google reCAPTCHA with AJAX not working
<p>I have form in 100.php with ajax call to 200.php.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;!-- include reCAPTCHA API JavaScript library given by Google --&gt;
    &lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;

     &lt;script type="text/javascript" 
     src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function() {            
    $("#btn").click(function(event){
       event.preventDefault();

        var myname = $("#name").val();
        var myaddress = $("#address").val();
        var yourData ='name='+myname+'&amp;address='+myaddress; // php is expecting name and age
        $.ajax({
          type:'POST',
          data:yourData,//Without serialized                
          url: '200.php',
          success:function(data) {
             if(data){
                $('#testform')[0].reset();//reset the form
                $('#result').html(data); // here html()
                //alert('Submitted');
             }else{
                return false;
              }                        
           }
         });

        });             
     });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;


    &lt;form method="post" id="testform"&gt;
        Name: &lt;input type="text" name="name" value="" id="name"/&gt; &lt;br /&gt;
        Address: &lt;input type="text" name="address" value="" id="address"/&gt;
        &lt;!-- 
            place for the reCAPTCHA widget div with your site key 
            data-theme="dark" attribute - gives dark version
        --&gt;
        &lt;div class="g-recaptcha" data-sitekey="6LeJ8h8TAAAAAMS9nQX89XccpsC-SDeSycipiaHN"&gt;&lt;/div&gt;
        &lt;input type="submit" name="ok" value="Send" id="btn"/&gt;
    &lt;/form&gt;
    &lt;div id='result'&gt;&lt;/div&gt;

&lt;/body&gt;
</code></pre>

<p></p>

<p>200.php does validate captcha and diaplay name and adddress user entered. But my problem is that when I entered name and address, click on captcha. Captha is also validated and shows as in my screenshot. but name and address is not shown on the page. You can also check yourself here: <a href="http://raveen.comlu.com/100.php" rel="nofollow">http://raveen.comlu.com/100.php</a></p>

<p>I am new to Ajax call by PHP. I googled and I can troubleshoot by firebug. Can you say what I am doing wrong here? and steps to troubleshoot by firebug like to check if my ajax call is done, etc? thanks for your help.</p>

<p>Note: when I put all these code in one page without using ajax call. it works fine!!!!! I want this happens without page reload.... </p>

<p><a href="http://i.stack.imgur.com/7PKcB.jpg" rel="nofollow">output</a></p>

<p>200.php </p>

<pre><code>&lt;?php
    require_once('recaptchalib.php');

    if( isset($_POST['ok']) ){

        if( isset($_POST['g-recaptcha-response']) &amp;&amp; !empty($_POST['g-recaptcha-response']) ){
            $secret = "6LeJ8h8TAAAAAB3IFQVQEaoApFe6lvq4Wxlktvn1"; //your secret key
            $response = null; //empty response
            $reCaptcha = new ReCaptcha($secret); //check secret key is present

            $response = $reCaptcha-&gt;verifyResponse( $_SERVER['REMOTE_ADDR'], $_POST['g-recaptcha-response'] );

            //$response variable will report back with "success"
            if( $response!=null &amp;&amp; $response-&gt;success ){
                echo "&lt;h1&gt;Hi ". $_POST['name']. " from ". $_POST['address']. ", thanks for submitting the form!&lt;/h1&gt;";
            }
        }
        else{
            echo "&lt;h1&gt;Please click on the reCAPTCHA box.&lt;/h1&gt;";
        }
    }

?&gt;
</code></pre>