Guest User

Untitled

a guest
Jan 13th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. validation to check database
  2. $("#registerForm").validate({
  3.  
  4. rules: {
  5.  
  6. BCNumber : { required: true, minlength: 5, maxlength: 10 },
  7. Username : { required: true, minlength: 5, maxlength: 10 },
  8. Password : { required: true, minlength: 5, maxlength: 10 },
  9. SecurityQuestion : { required: true, minlength: 5, maxlength: 10 },
  10. SecurityAnswer : { required: true, minlength: 5, maxlength: 10 },
  11.  
  12. }
  13.  
  14. $("#registerForm").submit(function(){
  15. var id=//find the value to be checked
  16. $.get("url?id="+id,function(data){
  17. if(data=="valid"){
  18. //submit the form
  19. }else
  20. {
  21. return false;
  22. }
  23. })
  24. })
  25.  
  26. $("#registerForm").validate({
  27. rules: {
  28. Username : {
  29. required: true,
  30. minlength: 5,
  31. maxlength: 10,
  32. remote: 'check_username.php'
  33. }
  34. }
  35. });
Add Comment
Please, Sign In to add comment