Javascript Registration Page - Check if user EXIST in DB

Started on the old forum in January 2013 · view the original in the archive · old links redirect here

2 replies · 4,894 views · started 13 years ago · 1 min read

3 participants
Pablo Developer · 164 posts #1

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

<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>
something else Fellow · 2,296 posts #2

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

in javascript it is done like this:

        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

Anthony Developer · 82 posts #3

FREE International SMS

GYSMS.com Provides FREE International sms Reach over 775 networks in more than 221 countries at no cost to you. and the Good News is we own our SMS Hardware so there is no third party SMS API involved our services are completely Ad supported.....

http://gysms.com

Send FREE International MMS and Share Files worldwide using our MMS Service.

http://gysms.net

GTriddim Live Online Radio Station

http://www.gtriddim.com

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close