Guest User

Untitled

a guest
Sep 26th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.    
  3.     // Defines what to post to the php script
  4.     $('form[name=login]').submit(function(){
  5.         var action = $('#login_form').attr('action');
  6.         var loginData = {
  7.             username: $('#username').val(),
  8.             password: $('#password').val(),
  9.             loginPost: 1
  10.         };
  11.    
  12.     // Checks if information entered is correct
  13.     $.ajax({
  14.         type: "POST",
  15.         url: action,
  16.         data: loginData,
  17.         success: function(response)
  18.         {
  19.             // If information is correct, then fade in success site
  20.             if(response == 'success')
  21.                 $('#login_success').show();
  22.             // If information is not correct, then show error message
  23.             else
  24.                 $('#login_error').show();
  25.         }
  26.         });
  27.         return false;
  28.     });
  29. });
Add Comment
Please, Sign In to add comment