title: Auto Fill second textbox with first textbox input
body: <p>auto fill second textbox with the input of first textbox. Like if I choose Jane as first name I want the second textbox to retrieve the last name from database and auto fill it with Doe. I am getting no auto input on second textbox not sure what I am doing wrong.</p>
  
  <p>Here is the test.php code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php   
  
  ?&gt;
  &lt;script src="jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
     $("#firstName").change(function(){
      var firstName=$(this).val();
       if(firstName != ''){
            $.ajax({
                                type:"post",
                                url:"insert_process.php",
                                data:"firstName="+firstName,
           datatype:"json",
                    success:function(data){ $("#lastname").val(data);
             $('#ename').css( "background-color","#B3CBD6"  ) 
          $('#ename').animate({backgroundColor: "#fff",});
            }
                                  
                                                          });
       }
       else{
        $("#lastname").val("");
        }
      });
    });
  &lt;/script&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Systems Request &lt;/title&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div align="center"&gt;
  
  &lt;form action = "insert.php" method ="post" class="form" style="width: 285px; height: 192px"&gt;
  
  &lt;br&gt;&lt;br&gt;First Name&lt;br&gt;
  &lt;input type="text" id="firstName" name="firstName"&gt;
  
  &lt;br&gt;&amp;nbsp;Last Name&lt;br&gt;
  &lt;input type="text" id="lastname" name="lastname" &gt;&lt;br&gt;&lt;br&gt;
  
  &lt;input type="submit" value= "Submit Name "&gt;&lt;br&gt;
  
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and then here is insert_proccess.php code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  header('Content-Type: application/json');
  $host = "localhost";
  $user = "root";
  $db_name= "people";
  $pass= "systems399";
  $con = mysql_connect($host, $user, $pass);
  $db_conx=mysql_select_db("people", $con);
  $fname=  $_POST["firstName"];
      $sql="SELECT * FROM  names WHERE firstName='$fname'   "; 
    $query= mysqli_query($db_conx, $sql);
   $row = mysqli_fetch_array($query2 MYSQLI_ASSOC);
   $rc = $row["lastname"];
  
  echo json_encode ($rc);
   
  ?&gt;</code></pre>
  </div>
  </div>
  </p>