
안녕하세요! 아까 했던 질문에 이어서 질문합니다.
rank값을 가져와 새 페이지를 띄우는 건 잘 되었습니다.
이제 팬명록 처럼 후기남기기 버튼을 누르면 DB에 reply를 새로 저장하여 그 곳에 name과 comment를 저장하고 싶은데요.

function save_comment(rank) {
let name = $('#name').val()
let comment = $('#comment').val()
$.ajax({
type: "POST",
url: `/reply/${rank}`,
data: {'name_give': name, 'comment_give': comment},
success: function (response) {
alert(response["msg"])
window.location.reload()
}
});
}
@app.route("/reply/<int:rank>", methods=["POST"])
def reply_post():
name_receive = request.form['name_give']
comment_receive = request.form['comment_give']
doc = {
'name': name_receive,
'comment': comment_receive
}
db.reply.insert_one(doc)
return jsonify({'msg': '댓글 쓰기 완료!'})
이렇게 팬명록과 같이 작성해보았는데, 아무리 해도 작동하지 않네요.
뭐가 문제일까요? 답변 부탁드립니다. :)
