title: Jquery create select tag with data from array
body: <p>I need to access database and update options of a select tag. My code is here.</p>
  
  <pre><code> $(window).load(function () {
  
       $.getJSON('http://localhost/ABC/web/app_dev.php/doctorFillOption', function (data) {
  
           var length = data.length,
               element = null;
           $('#idcatFill').append('&lt;select id ="idCat"  style="width:200px;margin-left:30px;margin-top:5px;" type="text"&gt;&lt;option value=""&gt;&lt;/option&gt;');
  
           for (var i = 0; i &lt; length; i++) {
               row = data[i];
               alert("id" + row['id'] + ' ' + row['category_name']);
               $('#idcatFill').append(
                   '&lt;option value="' + row['id'] + '"&gt;' + row['category_name'] + '&lt;/option&gt;'
               );
           }
  
       });
       $('#idcatFill').append('&lt;/select&gt;&lt;br/&gt;');
   });
  </code></pre>
  
  <p>But it doesn't get options. Need help. Thanks.</p>