title: Dropdown populate ajax
body: <p>I have the following issue: When i select an element from a drop down i want to auto populate another drop down via ajax. the idea is that the subcategory(sub_type) doesn't load after selecting the "type".</p>
  
  <pre><code>HTML
  &lt;select id="type" name="type"&gt;
  &lt;option value="1"&gt;General&lt;/option&gt;
  &lt;option value="2"&gt;Test&lt;/option&gt;
  &lt;/select&gt;
  &lt;select id="sub_type" name="sub_type"&gt;
  &lt;/select&gt;
  
  
  SCRIPT
      $("#type").change(function(){
      $.getJSON("ajax/add_subcathegory.php",{id: $(this).val(), ajax: 'true'}, function(j){
            var options = '';
            for (var i = 0; i &lt; j.length; i++) {
              options += '&lt;option value="' + j[i].id+ '"&gt;' + j[i].name+ '&lt;/option&gt;';
            }
          });
      $("#sub_type").html(options);
      });
  </code></pre>
  
  <p>My ajax script returns:</p>
  
  <pre><code>[{id: 0, name: 'Mark'}, {id:1, name: 'Andy'}, {id:2, name: 'Richard'}]
  </code></pre>
  
  <p>But the subcathegory (secont select) isn`t loaded.</p>