Javascript Registration Page - Check if user EXIST in DB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Javascript Registration Page - Check if user EXIST in DB

    I am making a registration page using js but having some difficulties checking if user exist in the database plz help me out with this

    HTML Code:
    <script type="text/javascript">
         $(document).ready(function(){
    		$("#regform").validate({
    			debug: false,
    			rules: {
    				username: "required",
                                    remote: {
                                    url: "check_user.php",
                                    type: "post",
                                     },
                                     
                                    password: "required",
    				email: {
    					required: true,
    					email: true
    				}
    			},
    		
                               messages: {
                                    username: {
                                      
    				required: "Please create a desired username!",
                                    remote: "u already exist",
                                    },
                       	        email: "Enter a valid email address!<br/>",
                                    password: "Please create a personal password!",
                                    
    			  },
    			
    submitHandler: function(form) {
    				
    // do other stuff for a valid form
    
    $.post('reg_submit.php', $("#regform").serialize(), function(data) {
    $('#insert').html(data);
    });
    
    }
    });
    });
    </script>

    #2
    the above is jquery but its similar to javascript...

    in javascript it is done like this:
    Code:
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open("POST", 'check_user.php', false);
            xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            xmlhttp.send(params);
            var response = xmlhttp.responseText;
    then response will be the variable that tells you if name is used or not.

    However i should imagine there is a much shorter way with jquery

    Comment


      #3
      check my posting here http://coding-talk.com/f16/using-jqu...atabase-23201/

      Comment

      Working...
      X