Estou fazendo isso mas não está dando certo, ele me retorna que a requisição foi efetuada com sucesso, mas não mostra o que eu coloquei para retorno no arquivo PHP.
ajax.js
$(function(){
mostraMesSelect();
Filtra_data_Banco(“m”);
var mesValue = $("#mesSelect");
mesValue.change(function(){
console.log(mesValue.val());
if(typeof mesValue == "undefined"){
Filtra_data_Banco("m");
}else{
Filtra_data_Banco(mesValue);
}
});
});
function Filtra_data_Banco(valor){
var mes = valor.toString();
$.ajax({
//type: "POST",
url: 'ajax-FiltrosDashboard.php',
data:{ "mesSelect": mes },
dataType: "text",
success:function(data){
console.log("Sucesso: "+data);
},
error: function (data) {
console.log("Erro: "+data);
},
});
}
function mostraMesSelect(){
$("#mesSelect").change(function(){
var mesText = $("#mesSelect option:selected").text();
$("#mesSelecionado").html('<h2 class="text-center">'+mesText+'</h2>');
});
}
ajax-FiltrosDashboard.php
<?php
echo "ok";