Advertisement
Guest User

Untitled

a guest
Jul 5th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. $("form").submit(function() {
  4. var user = $("#nick").val();
  5. var pass = $("#password").val();
  6. event.preventDefault();
  7.  
  8. $.ajax({
  9. type: "POST",
  10. url: "consulta.php",
  11. data: "nick="+user+"&password="+pass,
  12. dataType: "json",
  13. success: function(data){
  14. $("#resultado").html(data.nick);
  15. },
  16. error: function(jqXHR, textStatus, errorThrown) {
  17. console.log("ERRORRES ENCONTRADOS ==> ",jqXHR, textStatus, errorThrown);
  18. document.getElementById("resultado").innerHTML = "Error al realizar la consulta a la base de datos";
  19.  
  20. }
  21.  
  22. });
  23.  
  24. });
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement