커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
4주차 숙제
undefined주차
북마크
홍*리
댓글
11
추천
0
조회수
11
조회수
11
답변 완료



mongodb에서 name이 name으로 찍히고 comment는 comment로 찍혀요.. 다른 글자로 입력했는데..



스파르타 즉문즉답




작성한 코드 및 에러 메세지

오류 발생 시, 작성한 코드 function show_comment(){
$.ajax({
type: "GET",
url: "/homework",
data: {},
success: function (response) {
  let rows = response['comments']
  for (let i = 0; i < rows.length; i++) {
      let name = rows[i]['name']
      let comment = rows[i]['comment']

       let temp_html = `<div class="card">
                        <div class="card-body">
                        <blockquote class="blockquote mb-0">
                        <p>${comment}</p>
                        <footer class="blockquote-footer">${name}</footer>
                        </blockquote>
                        </div>
                        </div>`

      $('#comment-list').append(temp_html)
  }


}
});
}

에러 메시지를 첨부해 주세요.

Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요
@app.route("/homework", methods=["POST"])
def homework_post():
    name_receive = request.form['name_give']
    comment_receive = request.form['comment_give']

    doc = {
        'name':name_receive,
        'comment':comment_receive
    }
    db.homework.insert_one(doc)

    return jsonify({'msg':'응원 완료!'})

@app.route("/homework", methods=["GET"])
def homework_get():

homework_list = list(db.homework.find({}, {'_id': False}))

return jsonify({'comments':'comment_list'})

Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!




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