title: Type error : e is undefined
body: <p>I am getting a type error: e undefined on the javascript code. I am trying to populate a dropdown list using jquery with data sent from a mysql server. </p>
  
  <p>here is the javascript code    </p>
  
  <pre><code>$(document).ready(function(){// This script uses jquery and ajax it is used to set the values in
  $("#day").change(function(){// the time field whenever a day is selected.
      var day=$("#day").val();
      var doctor=$("#doctor").val();
      $.ajax({
          type:"post",
          url:"time.php",
          data:"day="+day+"&amp;doctor="+doctor,
          dataType : 'json',
          success:function(data){
              var option = '';
              $.each(data.d, function(index, value) {
                  console.log(data.d);
                  option += '&lt;option&gt;' + value.arr + '&lt;/option&gt;';
              });
              $('#timing').html(option);
          }
  
      });
  });
  });
  </code></pre>
  
  <p>Here's the php script which fetches data from a mysql database</p>
  
  <pre><code>$doctor = $_POST['doctor'];
  $day = $_POST['day'];
  $query="SELECT * FROM schedule WHERE doctor='$doctor' AND day='$day'";
  $arr = array();
  $result = mysqli_query($con, $query);
  $i = 0; 
  //Initialize the variable which passes over the array key values
  $row = mysqli_fetch_assoc($result);    //Fetches an associative array of the row
  $index = array_keys($row);             // Fetches an array of keys for the row.
  while($row[$index[$i]] != NULL)
  {
      if($row[$index[$i]] == 1) {
          //$res = $index[$i];
          //echo json_encode($res);
          array_push($arr, $index[$res]);
      }
      $i++;
  }       
  </code></pre>