
let formData = new FormData();
formData.append("title_give", "블랙팬서");
fetch("/test", { method: "POST", body: formData }).then(res => res.json()).then(data => {
console.log(data)
})
}
</script>
에서는 title_give와 블랙팬서 를 "" 로 감쌌어요.
그런데, 아래 app.py 코드에서는 ''로 감싸더라구요. 왜일까요?
string을 표시해주기 위한 문법이 html과 python 사이에 차이가 있는 걸까요?
@app.route('/test', methods=['POST'])
def test_post():
title_receive = request.form['title_give']
print(title_receive)
return jsonify({'result':'success', 'msg': '이 요청은 POST!'})
