Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. function autenticarme() {
  2. var nick = $(".txtNick").val();
  3. var pass = $(".txtPass").val();
  4. $.ajax({
  5. url: "login.aspx/conectarBD",
  6. data: "{ nick: '" + nick + "',password: '" + pass + "' }",
  7. type: "POST",
  8. dataType: "JSON",
  9. contentType: "application/json; charset=utf-8",
  10. success: function (data) {
  11. alert("Entro");
  12. }, error: function (xhr, status, error) {
  13. alert("Error");
  14. }
  15. });
  16. }
  17.  
  18. #region conectarBD
  19. [WebMethod]
  20. public static string conectarBD(string nick,string password)
  21. {
  22. Conexion conn = new Conexion();
  23. string respuesta = conn.Autentificar(nick,password);
  24. return respuesta;
  25.  
  26.  
  27. }
  28. #endregion
  29.  
  30. [WebMethod]
  31. public static object conectarBD(string nick, string password)
  32. {
  33. try{
  34. Conexion conn = new Conexion();
  35. string respuesta = conn.Autentificar(nick,password);
  36.  
  37. return new { success = true, data = respuesta };
  38. }
  39. catch (Exception e) {
  40. return new { success = false, data = e.Message };
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement