title: interlinked dropdown list is not working
body: <p>i am working with interlinked dropdown list i.e on selection of one dropdown list ajax call generated and populated another dropdown list and so on.  </p>
  
  <p>So my problem is with data coming from server side,on selection of each dropdown list i want to filter the available-results also,but the data that coming from server side get appended to <code>show div</code> i.e <code>dropdown-list items and results-items</code>.i only want to append <code>results-items to show div</code>.<br>
  <strong>client side code</strong> </p>
  
  <pre><code>        var country_code = $(this).val();
      console.log(country_code);
      if(country_code){
           $('#loadingmessage').show(); 
          $.ajax({
              type:'POST',
              url:'dependent.php',
              data:'country_code='+country_code,
              success:function(html){
                  console.log(html);
                  $('#state').html(html);
                  $('#city').html('&lt;option value=""&gt;Select state first&lt;/option&gt;'); 
                  $('#results').html(html);
                  $('#loadingmessage').hide();
              }
          }); 
      }else{
          $('#state').html('&lt;option value=""&gt;Select country first&lt;/option&gt;');
          $('#city').html('&lt;option value=""&gt;Select state first&lt;/option&gt;'); 
      }
  });
  </code></pre>
  
  <p><strong>server side code</strong>  </p>
  
  <pre><code> if(isset($_POST["country_code"]) &amp;&amp; !empty($_POST["country_code"])){
      $id = 1;
  $code = $_POST['country_code'];
  $code = mysqli_real_escape_string($conn,$code);
  $query = "SELECT * FROM plus2_state WHERE country_code = '$code' ORDER BY state ASC";
  $result = mysqli_query($conn,$query) or die(mysqli_error($conn));
  $rowCount = mysqli_num_rows($result);
  if($rowCount &gt; 0){
      while($row = mysqli_fetch_array($result)){ 
          echo '&lt;option class="state_option" value="'.$row['state_id'].'"&gt;'.$row['state'].'&lt;/option&gt;';        
      }
  }else{
      echo '&lt;option class="state_option" value=""&gt;State not available&lt;/option&gt;';
  }
  $query_1 = "SELECT * from content where country_code = '$code' ORDER BY emp_name ASC";
  $result_1 = mysqli_query($conn,$query_1) or die(mysqli_error($conn));
  $row_count = mysqli_num_rows($result_1);
  $_SESSION['result'] = array();
  if($row_count &gt; 0 )
  {
      while($content_rows = mysqli_fetch_array($result_1))
      {
          unset($_SESSION['result']);
          echo "&lt;div class='result'&gt;&lt;div class='col-md-3 photo-grid' style = 'float:left'&gt;
              &lt;div class = 'well well-sm'&gt;&lt;h4&gt;&lt;small&gt;".$content_rows['emp_name']."&lt;/small&gt;&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;";
              $_SESSION['result'][$id] =  array('name' =&gt; $content_rows['emp_name']);
      }
  }
  else
  {
      echo "&lt;div class = 'result'&gt;no results found&lt;/div&gt;";
  }
  $_SESSION['country_code'] = $code ;
  //print_r($_SESSION['result']);
  }
  </code></pre>