PHP Classes

File: account/assets/js/login.js

Recommend this page to a friend!
  Classes of Mohamed Elbahja  >  PHP Secure Login Library  >  account/assets/js/login.js  >  Download  
File: account/assets/js/login.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Secure Login Library
Login users and start sessions in a MySQL database
Author: By
Last change:
Date: 5 years ago
Size: 1,271 bytes
 

Contents

Class file image Download
$(document).ready(function() {

      $("#login").validate({
        rules: {
          email: {
            required: true,
            email: true
          },
          password: {
            required: true,
            minlength: 6
          }
        },

        submitHandler: function() {
          var data = $('#login').serialize();
          $.ajax({
            type: 'POST',
            url: 'submit/login.php',
            data: data,

            beforeSend: function() {
              $("#form-message").fadeOut('fast');
              $("#btn-submit").html(' Sending... ');
              $("#btn-submit").attr('disabled', true);
            },

            success: function(r) {
              if (r === 'success') {
                $("#btn-submit").html( r + ', Redirect... ');
                setTimeout(window.location.href = redirect_to, 5000);
              } else {
                  $("#form-message").fadeIn(0, function() {
                  $("#form-message").html('<div class="alert btn-danger"> ' + r + ' </div>');
                  $("#btn-submit").html(' Login');
                  $("#btn-submit").attr('disabled', false);
                });
              }
            }
          });
          return false;
        }

      });
});      
For more information send a message to info at phpclasses dot org.