Currently I have a jax call that takes me to my C # method to be able to authenticate my user, but this Ajax call is not working the succes part, since if it sends me to the method I want but in the end he does not send me the alert he should send when going through succes:
Ajax code
function autenticarme() {
var nick = $(".txtNick").val();
var pass = $(".txtPass").val();
$.ajax({
url: "login.aspx/conectarBD",
data: "{ nick: '" + nick + "',password: '" + pass + "' }",
type: "POST",
dataType: "JSON",
contentType: "application/json; charset=utf-8",
success: function (data) {
alert("Entro");
}, error: function (xhr, status, error) {
alert("Error");
}
});
}
C # method code
#region conectarBD
[WebMethod]
public static string conectarBD(string nick,string password)
{
Conexion conn = new Conexion();
string respuesta = conn.Autentificar(nick,password);
return respuesta;
}
#endregion