I'm using Bootstrap framework, and the Selectpicker class to get the city data as state. The script works fine, it returns data, but instead of entering <option> Cidade X </option>
it only inserts Cidade X
. I know the problem is in the class, but I do not know how to solve it.
Class:
<div class="col-md-3 col-xs-4" id="cidade">
<select data-width="auto" id="municipio" name="municipio" class="selectpicker municipio">
<option value="0" disabled="disabled">Selecione o estado</option>
</select>
</div>
Script:
$(document).ready(function(){
$("#estado").change(function() {
var est = document.getElementById("estado").value;
debugger;
$.ajax({
type: 'post',
url: 'cidade.php',
data: {
cd_estado: est
},
success: function(dados) {
$(".municipio").html(dados);
}
});
});
});