
@app.route("/reply/post", methods=["POST"])
def reply_post():
name_receive = request.form['name_give']
comment_receive = request.form['comment_give']
doc = {
'rank': int(rank),
'name': name_receive,
'comment': comment_receive
}
db.reply.insert_one(doc)
return jsonify({'msg': '후기 작성 완료!'})
app.py post 부분
function save_comment(rank) {
let name = $('#name').val()
let comment = $('#comment').val()
$.ajax({
type: 'POST',
url: `/reply/post/${rank}`,
data: {name_give: name, comment_give: comment},
success: function (response) {
alert(response['msg'])
window.location.reload()
}
})
}
index.html js 부분입니다.
"POST /reply/post/undefined HTTP/1.1" 404 -
라는 에러만 뜨는데 왜 이런 걸까요...
