This is the function:
function verificaProva(aluno,prova){
// define o retorno padrao
var res = 0;
// busca informação do servidor
$.ajax({
url : "funcoes.php",
type : 'post',
dataType : "json",
data : {acao: "verificaProva", id_aluno: aluno, id_prova: prova},
success : function(retorno){
if (retorno.status == "fez"){
res = 1;
alert("fez");
}
},
error : function(jqXHR, textStatus, errorThrown){
alert(textStatus+"\n"+errorThrown);
}
});
return res;
}
If the condition of the ajax return is true, the function displays an alert and arrow the variable to "1".
What happens is that the alert is being issued, but the variable does not change, why?