Guest User

Untitled

a guest
Sep 26th, 2018
115
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.         $.post('/assets/inc/login.php', {
  6.             username: $('[name=username]').val(),
  7.             password: $('[name=password]').val()
  8.         },
  9.             function(data) {
  10.                 // The password/username is correct
  11.                 if(data.success){
  12.                     $('span.username').text(data.user);
  13.                     $('#login_wrap').fadeOut('1500');
  14.                     $('#login_success').load('success.php').delay('1000').fadeIn('1500');
  15.                 }
  16.                 // Password/username was incorrect
  17.                 else{
  18.                     $('#login_error').show();
  19.                 }
  20.             }, 'json');
  21.         // Returns false to prevent updating of page   
  22.         return false;
  23.     });
  24. });
Add Comment
Please, Sign In to add comment