Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. $(function() {
  2.  
  3. // Setup form validation on the #register-form element
  4. $("#register_form").validate({
  5.  
  6. // Specify the validation rules
  7. rules: {
  8. register_username: "required",
  9. register_password: "required",
  10. register_email: {
  11. required: true,
  12. register_email: true
  13. },
  14. register_confirm_password: {
  15. required: true,
  16. minlength: 5
  17. },
  18. },
  19.  
  20. // Specify the validation error messages
  21. messages: {
  22. register_username: "Please enter your username",
  23. register_password: "Please enter your password",
  24. register_confirm_password: {
  25. required: "Please provide a password",
  26. minlength: "Your password must be at least 5 characters long"
  27. },
  28. register_email: "Please enter a valid email address",
  29. },
  30.  
  31. submitHandler(function(form) {
  32. $.ajax({
  33. type: 'POST',
  34. url: $(this).attr('action'),
  35. data: $(this).serialize(),
  36. dataType : 'json',
  37. success(function(data) {
  38. if (data){
  39. alert("success");
  40. // $(this)[0].reset();
  41. }
  42. })
  43. });
  44. return false;
  45. });
  46. });
  47.  
  48. });
  49.  
  50. var_dump($_POST);
  51.  
  52. submitHandler(function(form) {
  53. $.ajax({
  54. type: 'POST',
  55. url: $(this).attr('action'),
  56. data: $(this).serialize(),
  57. dataType : 'json',
  58. success(function(data) {
  59. if (data){
  60. alert("success");
  61. // $(this)[0].reset();
  62. }
  63. })
  64. });
  65. return false;
  66. });
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement