
해당 강의 시청 중에 계속해서 오류가 떠서 질문 드립니다. 도와주시면 감사하겠습니다
Access to XMLHttpRequest at 'https://owlbot.info/api/v4/dictionary/hi' from origin 'http://192.168.219.148:5000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
jquery.min.js:2 GET https://owlbot.info/api/v4/dictionary/hi net::ERR_FAILED <----오류
function get_definitions() {
$.ajax({
type: "GET",
url: `https://owlbot.info/api/v4/dictionary/${word}`,
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Token 2c540c9a349d72fd3b61a512763140f238457d9a");
},
data: {},
error: function (xhr, status, error) {
alert("에러 발생!");
},
success: function (response) {
console.log(response)
}
})
}
------------------------------------------------------------------------------------------------------------------------
@app.route('/detail/<keyword>')
def detail(keyword):
# API에서 단어 뜻 찾아서 결과 보내기
return render_template("detail.html", word=keyword)
