title: change options of select tag according to another
body: <p>this is my jqyery code in this i am calling a api and getting some employees id now i want to change options of my employees names according to those ids and remove all other basically i want only those names whose ids match with those ids</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
  
  
  $(document).ready(function(){
  
  $('#project_name').on('change', function() {
  //  var values;
  var item=$('#project_name :selected').val();
  alert(item);
  $.ajax({
     type: 'GET',
     url: 'http://localhost/programs/new/api/Project/get_employees_to_assinged_project?project_id='+item, //replace the plus by a comma
     success: function (data) {
        $.each(data, function(key,value){
      console.log(value.project_employee_id);
  // //
  // $("#employees_name option").filter('#'+value.project_employee_id,function() {
  //     // return this.text == text1;
  //  });
        });
              }
                });
  
  });
  });
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;form method="get"&gt;
                      &lt;button value="" name="datefilter" type="button" class="btn btn-default" id="daterange-btn"&gt;
                        &lt;span&gt;May 25, 2017 - June 7, 2017&lt;/span&gt;
                        &lt;i class="fa fa-caret-down"&gt;&lt;/i&gt;
                      &lt;/button&gt;
                      &lt;select id="project_name" name="project_name" style="width:200px;" class=""&gt;
                        &lt;option value=""&gt;No project&lt;/option&gt;
  
                                          &lt;option value="1"&gt;api&lt;/option&gt;
                                        &lt;option value="2"&gt;new project&lt;/option&gt;
                                        &lt;option value="3"&gt;new project2&lt;/option&gt;
                    
                    &lt;/select&gt;
                    &lt;select name="employees_name" style="width:200px;" class=""&gt;
                      &lt;option value=""&gt;No Employee&lt;/option&gt;
  
                                      &lt;option value="1"&gt;Administrator&lt;/option&gt;
                                    &lt;option value="2"&gt;sunitshakya&lt;/option&gt;
                                    &lt;option value="3"&gt;shikshasingh&lt;/option&gt;
                                    &lt;option value="255"&gt;abhishekshukla&lt;/option&gt;
                  
                  &lt;/select&gt;
  
                      &lt;input type="hidden" name="start" id="start" value=""&gt;
                      &lt;input type="hidden" name="end" id="end" value=""&gt;
  
                      &lt;input class="btn btn-primary" type="submit" name="submit"&gt;
                   &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
  
  
  $(document).ready(function(){
  
  $('#project_name').on('change', function() {
  //  var values;
  var item=$('#project_name :selected').val();
  alert(item);
  $.ajax({
     type: 'GET',
     url: 'http://localhost/programs/new/api/Project/get_employees_to_assinged_project?project_id='+item, //replace the plus by a comma
     success: function (data) {
        $.each(data, function(key,value){
      console.log(value.project_employee_id);
  // //
  // $("#employees_name option").filter('#'+value.project_employee_id,function() {
  //     // return this.text == text1;
  //  });
        });
              }
                });
  
  });
  });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>