I have json data below
{ "aaData": [["2","MAC"],["3","Apple"],["5","Windows"],["5","Unix"],["6","Linux"]]}
And I'm trying to use the jquery code below, but the data does not add with the select tag
<script type="text/javascript"> $(document).ready(function() { $("#mc_category").change(function() { $.getJSON("/admin/getSubCategory.php", null, function(data) { $("#subcategory").fillSelect(data); }); }); $.fn.fillSelect = function(data) { return this.clearSelect().each(function() { if (this.tagName == 'SELECT') { var dropdownList = this; $.each(data, function(index, optionData) { var option = new Option(optionData.Text, optionData.Value); if ($.browser.msie) { dropdownList.add(option); } else { dropdownList.add(option, null); } }); } }); } }); </script>
source share