let index = {
init: function () {
$("#btn-save").on("click", () => {
this.save();
});
},
save: function () {
let data = {
username: $("#username").val(),
password: $("#password").val(),
email: $("#email").val()
};
$.ajax({
type: "POST",
url: "/auth/joinProc",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
dataType: "json"
}).done(function (resp){
if (resp.status === 500) {
alert("회원가입에 실패하였습니다");
}
else{
alert("회원가입에 성공하였습니다");
location.href="/";
}
}).fail(function (error){
alert(JSON.stringify(error));
});
},
};
index.init();