Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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");
- }
- });
- }
- #region conectarBD
- [WebMethod]
- public static string conectarBD(string nick,string password)
- {
- Conexion conn = new Conexion();
- string respuesta = conn.Autentificar(nick,password);
- return respuesta;
- }
- #endregion
- [WebMethod]
- public static object conectarBD(string nick, string password)
- {
- try{
- Conexion conn = new Conexion();
- string respuesta = conn.Autentificar(nick,password);
- return new { success = true, data = respuesta };
- }
- catch (Exception e) {
- return new { success = false, data = e.Message };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement