I need to make when completing the AJAX request jquery insert the options into a select When you do this the options do not appear when you click, however the inspect shows that they are present in select
Request script:
$(document).ready(function(){
$.get("http://localhost/infinityy/assets/php/list-categories.php", function(data){
categories = JSON.parse(data);
var select = $("#category");
$(categories).each(function(){
var option = $("<option>");
option.attr("value", this.id);
option.text(this.name);
console.log(option);
select.append(option);
});
});
});
Select:
<form action="assets/php/add-category.php" method="post">
<div id="form" class="form-group">
<div class="form-group">
<label>Categoria <a href="#" class="add-category"><i class="fa fa-plus" aria-hidden="true"></i></a></label>
<select id="category" name="category" class="selectpicker" data-title="Categoria" data-style="btn-default btn-block" data-menu-style="dropdown-blue" required>
</div>
</div>
</form>
Result even by clicking does not appear options
**WheninspectingSelect:**