I'm doing a login screen in ASP.NET MVC. The framework makes all processes complete without errors: go to the database, query the login and return with an OK (user exists, I can authenticate). When the flow returns from the bank and passes through if (dados.OK)
, it has to throw me to another page, but this is not happening: simply the browser runs the code and does not throw me to the other page ( _ViewStart
)
What can it be? A better way? Tips?
$(document).ready(function () {
$("#status").hide();
$("#btLogar").click(function () {
$.ajax({
data: { Login: $("#txtLogin").val(), Senha: $("#txtSenha").val() },
dataType: "json",
type: "GET",
url: "/Login/AutenticarLogin",
async: true,
beforeSend: function () {
$("#status").html("Estamos autenticando o usuário... Só um instante.");
$("#status").show();
},
success: function (dados) {
if (dados.OK) {
$("#status").html(dados.Mensagem)
setTimeout(function () { window.location.href = "_ViewStart" }, 5000);
alert("logado");
$("#status").show();
}
else {
$("#status").html(dados.Mensagem);
$("#status").show();
}
},
error: function () {
$("#status").html(dados.Mensagem);
$("#status").show()
}
});
});