title: Populate select elements dynamically from json data file using jquery
body: <p>I'am trying to create search box for state districts and villages , but I'am enable to fetch data into combobox.</p>
  
  <p>I have tried so many other way to get data into select boxes they doesn't work. Below is the code I've so far:</p>
  
  <p>HTML:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="dummy__item"&gt;
    &lt;select name="state_id" id="state_id" tabindex="1"&gt;
      &lt;option value=""&gt;-- Select state --&lt;/option&gt;
  
  
    &lt;/select&gt;
  &lt;/div&gt;
  &lt;div class="dummy__item"&gt;
    &lt;select name="district_id" id="district_id" tabindex="2"&gt;
      &lt;option value=""&gt;-- Select district --&lt;/option&gt;
    &lt;/select&gt;
  &lt;/div&gt;
  &lt;div class="dummy__item"&gt;
    &lt;select name="village_id" id="village_id" tabindex="3"&gt;
      &lt;option value=""&gt;-- Select village --&lt;/option&gt;
    &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>&lt;!-- language: lang-js --&gt;
  
  function loadlist(selobj, url) {
    $(selobj).empty();
    $(selobj).append('&lt;option value="0"&gt;--Select Category--&lt;/option&gt;')
    $(selobj).append(
      $.map(jsonList, function(el, i) {
        return $('&lt;option&gt;').val(el.slno).text(el.state)
      }));
  }
  loadlist($('select#state_id').get(0), jsonList);
  </code></pre>