I'm working on a situation that I can not resolve for more than 2 days in a row. I have an AJAX that is requesting the values for a controller to populate a select with cities. The request seems to be (no error in debug), but nevertheless nothing comes in return.
JavaScript:
$(function() {
$('#selectEstado').change(function() {
var uf = $('#selectEstado').val();
$.ajax({
url: "busca/carregaCidades/" + uf,
dataType: "json",
success: function(data){
console.log(data);
}
});
});
});
Controller:
public function carregaCidades($uf)
{
$resultado = $this->busca_model->getCidades($uf);
return json_encode($resultado);
}
Model:
public function getCidades($uf)
{
$this->db->where('uf', $uf);
$dados = $this->db->get('tb_cidades')->result();
return $dados;
}
Even with no errors in the console, the result of the request does not come. Thanks for the help