title: Populate dropdown list from database using jQuery
body: <p>I want to populate the dropdown list from database using jQuery. But when i tried, i am getting empty response. see below code I didn't see any error.</p>
  
  <p>PHP code to get data:</p>
  
  <pre><code>if ($dat=="driver") {
      $q = "select * from drivers";
      $sql = mysql_query($q);
      $data = array();
      while($row = mysql_fetch_array($sql, true)){
          $data[] = $row; 
      };
      echo json_encode($data);
  }
  </code></pre>
  
  <p>jQuery code:</p>
  
  <pre><code>$.getJSON("get-data.php?dat=driver",function(data){
      $.each(data,function(key,val) {
          $("#night_Shift_text").append(
              $("&lt;option&gt;&lt;/option&gt;").val(value.id).html(value.id)
          );     
      });
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;select id='night_Shift_text'&gt;&lt;option&gt;&lt;/option&gt;&lt;/select&gt;
  </code></pre>
  
  <p>Debug console:</p>
  
  <p><a href="https://i.stack.imgur.com/E717b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E717b.png" alt="enter image description here"></a></p>