PHP Classes

File: account/assets/js/register.js

Recommend this page to a friend!
  Classes of Mohamed Elbahja  >  PHP Secure Login Library  >  account/assets/js/register.js  >  Download  
File: account/assets/js/register.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,840 bytes
 

Contents

Class file image Download
$(document).ready(function() {
  
      $("#register").validate({
        rules: {
          fname: {
            required: true,
            minlength: 3,
            maxlength: 19
          },
          lname: {
            required: true,
            minlength: 3,
            maxlength: 19
          },
          username: {
            required: true,
            minlength: 4,
            maxlength: 15
          },
          email: {
            required: true,
            email: true
          },
          password: {
            required: true,
            minlength: 6
          },
          repassword: {
            required: true,
            equalTo: '#password'
          }
        },
        messages: {
          repassword: {
            equalTo: 'The Passwords did not match'
          }
        },
        submitHandler: function() {
          var data = $('#register').serialize();
          $.ajax({
            type: 'POST',
            url: 'submit/register.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 = 'verify.php', 5000);
              } else {
                  $("#form-message").fadeIn(0, function() {
                  $("#form-message").html('<div class="alert btn-danger"> ' + r + ' </div>');
                  $("#btn-submit").html(' Register');
                  $("#btn-submit").attr('disabled', false);
                });
              }
            }
          });
          return false;
        }

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