Guest User

Untitled

a guest
Jun 12th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $("#login").click(function() {
  2.  
  3.                     var action = $("#login_form").attr('action');
  4.                     var form_data = {
  5.                         username: $("#username").val(),
  6.                         password: $("#password").val(),
  7.                         is_ajax: 1
  8.                     };
  9.                    
  10.                     if($("#login-status").attr("class") != "loading") {
  11.                         $("#login-status").addClass("loading");
  12.                         $("#login-status").html("Loading..");
  13.                         $("#login-status").show();
  14.                     }
  15.                     $("#login-content").html("<center><img src='images/ajax-loading.gif'></center>");
  16.  
  17.                 $.ajax({
  18.                     type: "POST",
  19.                     url: action,
  20.                     data: form_data,
  21.                     success: function(response)
  22.                     {
  23.                         if(response == 'success') {
  24.                             if($("#login-status").attr("class") != "success") {
  25.                                 $("#login-status").hide();
  26.                                 $("#login-content").load('login.php');
  27.                                 $("#login-status").addClass("success");
  28.                                 $("#login-status").html("Success!!");
  29.                                 $("#login-status").show();
  30.                             }
  31.                         document.location='';
  32.                         } else {
  33.                             if($("#login-status").attr("class") != "login-error") {
  34.                                 $("#login-status").hide();
  35.                                 $("#login-content").load('login.php');
  36.                                 $("#login-status").removeClass("loading");
  37.                                 $("#login-status").addClass("login-error");
  38.                                 $("#login-status").html("Wrong Data!");
  39.                                 $("#login-status").show();
  40.                             }
  41.                         }
  42.                            
  43.                     }
  44.                 });
  45.  
  46.             return false;
  47.         });
Add Comment
Please, Sign In to add comment