<tr>
<td>* 아이디</td>
<td><input type="text" id="memberId" name="memberId">
</td>
<td id="msg"></td>
</tr>
$('#memberId').on("input", function() {
var memberId = $('#memberId').val();
$.ajax({
url:"/member/check.kh",
data:{"memberId":memberId},
type:"get",
success:function(result){
if(result>0){
$('#msg').html("<b><font color='red'>이미 사용중인 아이디 입니다</b></font>");
}
if(result==0){
$('#msg').html("<b><font color='blue'>사용가능한 아이디입니다</b></font>")
}
},
error:function(){
alert("에러!")
}
})
})
@ResponseBody
@RequestMapping(value = "/member/check.kh", method = RequestMethod.GET)
public String checkOneId(@RequestParam("memberId") String memberId) {
int result = mService.checkOneId(memberId);
return result+"";
}
<select id="selectOneById" resultType="_int">
select count(MEMBER_ID) from member_tbl where member_id = #{memberId}
</select>
gif로 하고 싶은데 학원은 gif 캡쳐 프로그램이 없어서…
어쨋든 한글자 한글자를 칠때마다 바로 유효성체크를 하는 코드가 완성되었다!!
요즘 너무 jquery를 쓰는것 같다 편하고 빠르니까 수업 수강중에는 안쓸수는 없는데 자바스크립트로 해당 코드를 쓸줄알아야 하는데 그것이 잘 안되는거 같다
둘중에 하나만쓰면 나머지 하나는 금방 까먹게 된다,