Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ON CLICK BUTTON REGISTER
- $('#register').click(function () {
- //DEF VARIABLE INPUT
- var username = $("#username").val();
- var email = $("#email").val();
- var password = $("#password").val();
- var passwordc = $("#passwordc").val();
- //IF INPUT ARE EMPTY
- if (username == "" || email == "" || password == "" || passwordc == "")
- {
- swal({
- type: 'error',
- title: error_fill_fields,
- showConfirmButton: false,
- timer: 2000
- })
- }
- //EMAIL FORMAT
- else if (!validateEmail(email))
- {
- swal({
- type: 'error',
- title: error_email_format,
- showConfirmButton: false,
- timer: 2000
- })
- }
- //PASSWORD VERIFY
- else if (password != passwordc)
- {
- swal({
- type: 'error',
- title: error_password_passwordc,
- showConfirmButton: false,
- timer: 2000
- })
- }
- else
- {
- $.ajax({
- url: 'actionAccountCtrlr-register.php',
- type: 'POST',
- data: 'username=' + username + '&email=' + email + '&password=' + password,
- dataType: 'html',
- success: function (data) {
- if (data == "username")
- {
- swal({
- type: 'error',
- title: error_username_use,
- showConfirmButton: false,
- timer: 2000
- })
- }
- else if (data == "email")
- {
- swal({
- type: 'error',
- title: error_email_use,
- showConfirmButton: false,
- timer: 2000
- })
- }
- else if (data == "success")
- {
- swal({
- type: 'success',
- title: success_register,
- text: success_redirection,
- showConfirmButton: false,
- timer: 3000
- })
- window.setTimeout(function() {
- window.location.href = '/';
- }, 3000);
- }
- else
- {
- swal({
- type: 'error',
- title: error_attempt,
- showConfirmButton: false,
- timer: 2000
- })
- }
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement