2
Hello! I am new in php and am starting with ajax, I would like a help because I am locked in this project. I am passing this connection ajax and using the data Return to send the object to my other function. However my log console shows that I am sending a string and not an object as expected.
function carregarDados(arquivo, type, dados, metodo){
$.ajax({
url: '../controller/'+arquivo+'Controller.php?metodo='+metodo,
type: type,
dataType: 'json',
data: dados,
success: function(dados){
}
});
return dados;
}
function logar(){
var dados = $('#formLogin').serialize();
var retorno = carregarDados('login', 'post', dados, 'logar');
console.log(retorno);
}