
from flask import Flask,render_template,request,jsonify
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/test', methods=['GET'])
def test_get():
title_receive = request.args.get('title_give')
print(title_receive)
return jsonify({'result':'success', 'msg': '이 요청은 GET!'})
if __name__ == '__main__':
app.run('0.0.0.0',port=5001,debug=True)
app.py코드
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
function hey(){
$.ajax({
type: "GET",
url: "/test?title_give=봄날은간다",
data: {},
success: function(response){
console.log(response)
}
})
}
</script>
</head>
<body>
<text>야옹이</text>
<button onclick="hey">button</button>
</body>
</html>
index.html전체코드

로컬호스트 전체화면입니다
보시다시피 get /msg를 못가져오고있고 ajax코드는 그대로 가져왔는데 활성화가 되지않는 것으로 보여지네요
어떤게 문제일까요?
