My process is like this: I have a dropdown menu and text box. When I select an id (unique id) from dropdown and then click submit button want to display corresponding name to text box.

My database fields :

1. `id` (Auto increment)
2. `AgencyName_id` (unique id)
3. Name

dispay.html

```
<select name="agencyID_dwn" class="idLookup_dwn"  id="agencyID_dwn" >
<option selected>...Select...</option>
  <?php
  while($row = mysqli_fetch_array($result)){
  ?>

   <option value="<?php echo $row['AgencyName_id'];?>"> 
   <?php echo $row['AgencyName_id'];?></option>
 <?php
  }
   ?>
    </select>
        // for input text
        <input type="text" id="testid">
        // submit button
         <input type="submit" name="lookupSubmit">

```

dataGet.php

```
            <?php
            if (isset($_POST["lookupSubmit"])) {

            $user_id=$_POST['agencyID_dwn'];

             $query = "select * from AgencyHome where AgencyName_id = '$user_id'" ;
        $result=mysqli_query($db, $query);

        $data =  mysqli_fetch_assoc($result);

       echo json_encode($data);
         exit();

       }

        ?>

```

myjson.js

```
           <script src="//code.jquery.com/jquery-1.11.2.min.js">                </script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js">  </script>
    <script type="text/javascript">
      $(document).ready(function(){

      $('#agencyID_dwn').change(function(){

    var reg_number = $(this).val();
      var data_String;
     data_String = 'reg_number='+reg_number;
    $.post('dataGet.php',data_String,function(data){
      var data= jQuery.parseJSON(data);

       $('#testid').val(data.Name);

          });
       });
      });

      </script>

```

When i click submit button
I got the database results as array in "dataGet.php".But in textbox did not display the result.Any mistake in my code?