title: Generate select list options in javascript after recevinig JSON data from Controller
body: <p>I have a list in Controller (MVC)</p>
  
  <pre><code>public CompanyController() {
           _company = new List&lt;CompanyModel&gt;{
              new CompanyModel{Name="A 1", Email="a1@company.com", Group="Group1"},
              new CompanyModel{Name="A 2", Email="a2@company.com", Group="Group2"},
              new CompanyModel{Name="A 3", Email="a3@company.com", Group="Group3"},
              new CompanyModel{Name="B 1", Email="b1@company.com", Group="Group1"},
              new CompanyModel{Name="C 1", Email="c1@company.com", Group="Group2"},
              new CompanyModel{Name="D 1", Email="d1@company.com", Group="Group4"},
              new CompanyModel{Name="E 1", Email="e1@company.com", Group="Group5"},
              new CompanyModel{Name="E 2", Email="e2@company.com", Group="Group6"},
              new CompanyModel{Name="F 1", Email="f1@company.com", Group="Group6"},
              new CompanyModel{Name="G 1", Email="b1@company.com", Group="Group5"},
              new CompanyModel{Name="H 1", Email="b1@company.com", Group="Group6"},
              new CompanyModel{Name="I 1", Email="b1@company.com", Group="Group3"},
              new CompanyModel{Name="J 1", Email="b1@company.com", Group="Group7"},
              new CompanyModel{Name="K 1", Email="b1@company.com", Group="Group6"},
              new CompanyModel{Name="L 1", Email="b1@company.com", Group="Group1"},
              new CompanyModel{Name="M 1", Email="b1@company.com", Group="Group2"},
              new CompanyModel{Name="N 1", Email="b1@company.com", Group="Group2"},
              new CompanyModel{Name="O 1", Email="b1@company.com", Group="Group4"},
              new CompanyModel{Name="P 1", Email="b1@company.com", Group="Group5"},            
              new CompanyModel{Name="R 1", Email="b1@company.com", Group="Group5"},
              new CompanyModel{Name="S 1", Email="b1@company.com", Group="Group8"},
              new CompanyModel{Name="T 1", Email="b1@company.com", Group="Group8"},
              new CompanyModel{Name="U 1", Email="b1@company.com", Group="Group1"},
              new CompanyModel{Name="V 1", Email="b1@company.com", Group="Group2"},
              new CompanyModel{Name="X 1", Email="b1@company.com", Group="Group4"},
              new CompanyModel{Name="Y 1", Email="b1@company.com", Group="Group3"},
              new CompanyModel{Name="Z 1", Email="b1@company.com", Group="Group3"},
              new CompanyModel{Name="W 1", Email="b1@company.com", Group="Group6"},
           };
        }
  </code></pre>
  
  <p>which I sent via JSON to JQuery as:</p>
  
  <pre><code>objectCompany = null;
  data = "";
  
  $.ajax({
           url: '/Company/List',
           dataType: 'json',
           contentType: 'application/json; charset=utf-8',
           success: function (msg) {
              data = msg;
           },
           complete: function () {
              objectCompany = data;
           }
        });
  </code></pre>
  
  <p>I want to append to my <code>select</code> tag <code>&lt;select name="filters" id="filters"&gt;&lt;/select&gt;</code> all options which has <code>Group</code> values without repeating the similar values.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>if (objectCompany != null) {
       $("#filters").empty();
       $("#filters").html("&lt;option value='all' selected='selected'&gt;All groups&lt;/option&gt;");
       var arrayUnique = [];
       for (var i = 0; i &lt; objectCompany .length; i++) {
          for (var j = i + 1; j &lt; objectCompany .length; j++) {
             if (objectCompany [i].Group === objectCompany [j].Group) {
                j = ++i;
             }
          }
          arrayUnique.push(objectCompany [i].Group);
       }
  
       arrayUnique = arrayUnique.sort();
  
       $.each(arrayUnique, function (k, v) {
          $("#filters").append("&lt;option value='" + v + "'&gt;" + v + "&lt;/option&gt;");
       });
        }
  </code></pre>
  
  <p>Update: Now it works :)</p>