title: PHP Ajax dependent dropdown not working
body: <p>I am trying to implement dependent dropdown using ajax and php. But anyhow the response from second dropdown is not coming. after checking in console, I am able to see the id of first dropdown but no response from second dropdown. So, When i click on first dropdown, I just get a blank value in Second dropdown.</p>
  
  <p>HTML Code</p>
  
  <pre><code> &lt;div class="col-md-6"&gt;
                                                      &lt;?php
                                                      require_once('db.php');
                                                      $varient_result = $conn-&gt;query('select * from tv_varient');
                                                      ?&gt;
                                                      &lt;select name="varient" id="varient-list" class="form-control  c-square c-theme" required&gt;
                                                          &lt;option value=""&gt;Select Varient&lt;/option&gt;
                                                          &lt;?php
                                                              if ($varient_result-&gt;num_rows &gt; 0) {
                                                              // output data of each row
                                                              while($row = $varient_result-&gt;fetch_assoc()) {
                                                          ?&gt;
                                                          &lt;option value="&lt;?php echo $row["id"]; ?&gt;"&gt;&lt;?php echo $row["name"]; ?&gt;&lt;/option&gt;
                                                          &lt;?php
                                                          }
                                                          }
                                                          ?&gt;
                                                      &lt;/select&gt;
                                                   &lt;/div&gt;    
                                                      &lt;/br&gt;&lt;/br&gt;
  
                                                          &lt;label for="inputPassword3" class="col-md-4 control-label" style="margin-left: 15px;"&gt;Price:&lt;/label&gt;
                                                              &lt;div class="col-md-6"&gt;
                                                                  &lt;select name="price" id="price-list" class="form-control  c-square c-theme" required&gt;
                                                                      &lt;option value=''&gt;Select Price *&lt;/option&gt;
                                                                  &lt;/select&gt;
                                                              &lt;div&gt;
                                                                  &lt;/div&gt;
                                                         &lt;/div&gt;
                                                    &lt;/div&gt;
                                                      &lt;/div&gt; 
                                                  &lt;/div&gt;
  
  AJAX Code
                                                           &lt;script&gt;
                                                                  $('#varient-list').on('change', function(){
                                                                   var varient_id = this.value;
                                                                   $.ajax({
                                                                   type: "POST",
                                                                   url: "get_price.php",
                                                                   data:'varient_id='+varient_id,
                                                                   success: function(result){
                                                                   $("#price-list").html(result);
                                                                    }
                                                                   });
                                                                  });
                                                              &lt;/script&gt;
  </code></pre>
  
  <p>get_price.php</p>
  
  <pre><code>?php
  require_once('db.php');
  //$country_id = mysqli_real_escape_string($_POST['country_id']);
  //var_dump($country_id);
  //var_dump($_POST['country_id']);
  $varient_id = $_POST['veriant_id'];
  echo $varient_id;
  //var_dump($varient_id);
  var_dump($_POST['varient_id']);
  if($varient_id!='')
  {
      $states_result = $conn-&gt;query('select * from tv_price where veriant_id='.$varient_id.'');
      $options = "&lt;option value=''&gt;Select Price&lt;/option&gt;";
      while($row = $states_result-&gt;fetch_assoc()) {
  
      $options .= "&lt;option value='".$row['price']."'&gt;".$row['price']."&lt;/option&gt;";
      }
      echo $options;
  }
  
  ?&gt;
  </code></pre>