아이디 유효성 검사 ajax 안되는 이유가 무엇일까요..

아이디 유효성 검사 ajax 안되는 이유가 무엇일까요..

QA

아이디 유효성 검사 ajax 안되는 이유가 무엇일까요..

본문

제일 아래에 두문단 아이디 중복체크, 패스워드 일치는 잘 작동합니다.

function registerCheckFunction() { ~~~

 

function passwordCheckFunction() {~~~

 

 

하지만 그 위의 친구들은 작동하지 않는데 무엇이 문제일까요?

db까지 갔다오는건 중복체크만 아닌가요??...

 

script type="text/javascript">

let usernameCheck = /[가-힣A-Za-z\d]{4,10}$/; // 최소4자, 최대 10자의 문자

let passwordCheck = /(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/; //최소 8 자, 최소 하나의 문자 및 하나의 숫자

let numberCheck = /[0-9]/; // 숫자인경우

let nameCheck = /[a-zA-Z가-힣]/; // 한글, 영어만 

 

$('#username').blur(function(){

    console.log($('#username'),val());

    if($('#username').val().length < 4){

        $('#helper1').text("4자 이상 입력해주세요.");

    } if($('#username').val().length > 11) {

        $('#helper1').text("10자 이하로 입력해주세요.");

    }

});

 

$('#password').blur(function(){

console.log($('#password').val());

if(!passwordCheck.test($('#password').val())){

console.log("비밀번호가 유효하지 않습니다.");

$('#helper2').text("최소8자 이상, 하나의 문자 및 숫자를 입려해주세요");

}else{

console.log("비밀번호 사용가능");

$('#helper2').text("사용가능한 비밀번호입니다.");

}

});

 

$('#name').blur(function(){

console.log($('#name').val());

if(!nameCheck.test($('#name').val())){

        $('#helper3').text("문자만 입력하세요.");

    }else{

console.log("비밀번호 입력가능");

$('#helper3').text("--");

}

});

 

$('#phone').blur(function(){

console.log($('#phone').val());

if(!numberCheck.test($('#phone').val())){

$('#helper4').text("숫자만 입력 가능합니다.");

}else{

console.log("입력가능");

$('#helper4').text("입력가능합니다.");

}

});

 

 

        function registerCheckFunction() {

        

         var username = $('#username').val();

         $.ajax({

         type: 'POST',

         url: './UserRegisterCheckServlet',

         data:  {username: username},

         success: function(result) {

         if(result == 1) {

         $('#registerCheckMessage').html('*사용 가능한 아이디입니다.');

         $('#registerCheckMessage').css('color','green');

         }

         else {

         $('#registerCheckMessage').html('*이미 사용중인 아이디입니다.');

         $('#registerCheckMessage').css('color','#d64643');

         }

         }

        

         });

           

} ;

         function passwordCheckFunction() {

         var password1 = $('#password1').val();

         var password2 = $('#password2').val();

         if(password1 != password2) {

         $('#passwordCheckMessage').html('*비밀번호가 일치하지 않습니다.');

         }  else{

         $('#passwordCheckMessage').html('');

         } 

         };

       

    </script>

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 59,604
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT