커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
화성땅 공동구매
undefined주차
북마크
박*인
댓글
12
추천
0
조회수
29
조회수
29
답변 완료

화성땅 공동구매에서 데이터 입력하고 주문하기를 누르면 mongodb에 데이터가 들어가는 작업을 하고 있는데


app.py에서 아래와 같이 입력하고

@app.route("/mars", methods=["POST"])
def web_mars_post():
    name_receive = request.form['name_give']
    address_receive = request.form['address_give']
    size_receive = request.form['size_give']
    doc = {
        'name':name_receive,
        'address':address_receive,
        'size':size_receive
    }
    db.mars.insert_one(doc)


index.html에 아래와 같이 입력했는데

function save_order() {
    let name = $('name').val()
    let address = $('address').val()
    let size = $('size').val()

    $.ajax({
        type: 'POST',
        url: '/mars',
        data: { name_give : name, address_give : address, size_give : size},
        success: function (response) {
            alert(response['msg'])
            window.location.reload()
        }
    });
}

ajax에 data부분에 name_give, address_give, size_give 부분이 색깔이 안변해요ㅜㅜ

그냥 돌려봤는데 아래처럼 오류가 나서요ㅜㅜㅠㅜ 인식이 안되는거 같은데 어떻게 해야할까요ㅠㅠ

werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.

KeyError: 'name_give'




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