커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
ajax로 단어 뜻가져오기 질문 있습니다!
undefined주차
북마크
함*문
댓글
21
추천
0
조회수
87
조회수
87
답변 완료

해당 강의 시청 중에 계속해서 오류가 떠서 질문 드립니다. 도와주시면 감사하겠습니다

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)
취소
 공유
취소
댓글 0
댓글 알림
나의얼굴