id : <input type="text" name="userId" id="userId" required />
password : <input type="password" name="userPw" id="userPw" required />
<button type="button" id="sendBtn">Login</button>
<script type="text/javascript">
$("#sendBtn").click(function(){
var user_id = ${"#userId"}.val();
var user_pw = ${"#userPw"}.val();
console.log(user);
$.ajax({
url : "login",
data : {
userId : user_id,
userPw : user_pw
},
type : "post",
dataType : "json",
async : true,
success : function(data){
console.log("success");
},
error : function(error){
console.log("fail");
}
});
});
</script>
여기서
var user_id = ${"#userId}.val(); 에서
예기치 않은 식별자 오류가 뜹니다. 다 맞게 작성한 것 같은데 왜 그런지 모르겠습니다.
답변해 주시면 감사하겠습니다.