brown2005 Posted November 12, 2011 Share Posted November 12, 2011 $(document).ready(function(){ var form = $("#register-form"); var username = $("#username"); var username_error = $("#username_error"); username.blur(validateName); username.keyup(validateName); var email = $("#email"); var email_error = $("#email_error"); email.blur(validateEmail); email.keyup(validateEmail); var password = $("#password"); var password_error = $("#password_error"); password.blur(validatePassword); password.keyup(validatePassword); var password_confirm = $("#password_confirm"); var password_confirm_error = $("#password_confirm_error"); password_confirm.blur(validatePasswordConfirm); password_confirm.keyup(validatePasswordConfirm); form.submit(function(){ if(validateName() & validateEmail() & validatePassword() & validatePasswordConfirm()) return true else return false; }); function validateName(){ if(username.val() == ''){ username_error.html('<span class="is_not_available">Please enter a username.</span>'); return false }else{ if(username.val().length < 5){ username_error.html('<span class="is_not_available">Username must be a minimum of 5 characters.</span>'); return false }else{ username_error.html('<img src="images/loading.gif" /> Checking...'); var username1 = $('#username').val(); $.post("check_username.php", { username: username1 }, function(result){ if(result == 1){ $('#username_error').html('<span class="is_available">' +username1 + ' is available.</span>'); return true }else{ $('#username_error').html('<span class="is_not_available">' +username1 + ' is not available.</span>'); return false } }); } } } function validateEmail(){ if(email.val() == ''){ email_error.html('<span class="is_not_available">Please enter a email.</span>'); return false }else{ email_error.html('<span class="is_not_available"></span>'); return true } } function validatePassword(){ if(password.val() == ''){ password_error.html('<span class="is_not_available">Please enter a password.</span>'); return false }else{ password_error.html('<span class="is_not_available"></span>'); return true } } function validatePasswordConfirm(){ if(password_confirm.val() == ''){ password_confirm_error.html('<span class="is_not_available">Please enter a password confirmation.</span>'); return false }else{ password_confirm_error.html('<span class="is_not_available"></span>'); return true } } }); the above code does not go to my register-process.php when all ok, but if i take out the below it does... var username1 = $('#username').val(); $.post("check_username.php", { username: username1 }, function(result){ if(result == 1){ $('#username_error').html('<span class="is_available">' +username1 + ' is available.</span>'); return true }else{ $('#username_error').html('<span class="is_not_available">' +username1 + ' is not available.</span>'); return false } Quote Link to comment https://forums.phpfreaks.com/topic/251006-why-does-this-not-go-to-registration-processphp/ Share on other sites More sharing options...
brown2005 Posted November 13, 2011 Author Share Posted November 13, 2011 I have attached my jquery It all works fine. checks username and email in mysql.. but the submit button doesnt go to register-process.php when everything is ok. any ideas please? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/251006-why-does-this-not-go-to-registration-processphp/#findComment-1287791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.