join.js
2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$(function(){
// 회원 가입 처리
$('#join-submit').click(function(e){
e.preventDefault();
if($("#inputName").val() ==''){
alert('이름을 입력하세요');
$("#inputName").focus();
return false;
}
var email = $('#InputEmail').val();
if(email == ''){
alert('이메일을 입력하세요');
$("#InputEmail").focus();
return false;
} else {
var emailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!emailRegex.test(email)) {
alert('이메일 주소가 유효하지 않습니다. ex)abc@gmail.com');
$("#inputEmail").focus();
return false;
}
}
if($("#inputPassword").val() ==''){
alert('비밀번호를 입력하세요');
$("#inputPassword").focus();
return false;
}
if($("#inputPasswordCheck").val() ==''){
alert('비밀번호를 다시 한번 더 입력하세요');
$("#inputPasswordCheck").focus();
return false;
}
if($("#inputPassword").val()!== $("#inputPasswordCheck").val()){
alert('비밀번호를 둘다 동일하게 입력하세요');
return false;
}
if($("#inputMobile").val() ==''){
alert('휴대폰 번호를 입력하세요');
$("#inputMobile").focus();
return false;
}
if($("#agree").is(":checked") == false){
alert('약관에 동의하셔야 합니다');
return false;
}
$.ajax({
url: 'register.php',
type: 'POST',
data: {
name:$("#inputName").val(),
userID:$('#InputEmail').val(),
email:$('#InputEmail').val(),
password:$('#inputPassword').val(),
telNO:$("#inputtelNO").val(),
mobileNO:$("#inputMobile").val()
},
dataType: "json",
success: function (response) {
if(response.result == 1){
alert('가입 완료');
location.replace('../index.php'); // 화면 갱신
} else if(response.result == 0){
alert('이미 가입된 아이디입니다');
} else if(response.result == -2){
alert('입력된 값이 없습니다');
} else {
alert('등록중에 에러가 발생했습니다');
}
},
error: function(jqXHR, textStatus, errorThrown){
alert("arjax error : " + textStatus + "\n" + errorThrown);
}
});
});
});