커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
화성땅 DB 내용을 GET으로 불러오는 것 입니다.
undefined주차
북마크
박*찬
댓글
3
추천
0
조회수
6
조회수
6
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


alert 하면 내용이 담겨오는 것 같은데, 이를 console 예 찍어보면 아무런 내용이 없습니다.



스파르타 즉문즉답


작성한 코드 및 에러 메세지

$(document).ready(function () {

show_order();

});


function show_order() {

$.ajax({

type: 'GET',

url: '/mars',

data: {},

success: function (response) {

alert(response)

}

});

}


---------------

$(document).ready(function () {

show_order();

});


function show_order() {

$.ajax({

type: 'GET',

url: '/mars',

data: {},

success: function (response) {

console.log(response)

}

});

}


----------------- app.py 부분입니다.

@app.route('/mars', methods = ['GET'])

def test_get():

order = list(db.mars.find({}, {'_id':False}))

return jsonify({'orders':order})

---------------- 해당부분에서 print(order) 하면 DB에 있는 값이 불러져 옵니다.

스파르타 즉문즉답


취소
 공유
취소
댓글 0
댓글 알림
나의얼굴