Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     $("#register_form").submit(function() {
  3.         $('#register_result').html('<img src="path to file" /> Registering...');
  4.         $.ajax({
  5.             type: "POST",
  6.             url: "path to file",
  7.             data: {
  8.                 email: $('#email').val(),
  9.                 user: $('#user').val(),
  10.                 pass: $('#pass').val(),
  11.                 pass2: $('#pass2').val()
  12.             },
  13.             success: function(result) {
  14.                 if(result == 1){
  15.                     $('#register_result').html('Username taken!');
  16.                 } else if(result == 0) {
  17.                     $('#register_result').html('Error in the form (make sure nothing was left blank and passwords match)');
  18.                 } else if(result == 2) {
  19.                     $('#register_result').html('Incorrect style of email, please re-check that its correct!');
  20.                 } else if(result == 3) {
  21.                     $('#register_result').html('Success! Account created');
  22.                 } else {
  23.                     $('#register_result').html('Something went wrong, we will get our crack team of nerds to help fix your problem!');
  24.                 }
  25.             },
  26.             error: function(jqXHR, textStatus, errorThrown) {
  27.                 alert(JSON.stringify(jqXHR));
  28.             }
  29.         });
  30.         return false;
  31.     });
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement