QueryDict always empty from AJAX POST

前端 未结 2 1493
一向
一向 2021-01-18 03:57

I have seen a few of these questions asked but I have tried to implement their solutions and it hasn\'t worked for me.

I am trying to send a basic AJAX request to a

2条回答
  •  甜味超标
    2021-01-18 04:31

    Django doesn't really de-serialize JSON payloads for you. request.POST is meant to be used for HTML posted forms, and the like.

    For JSON payloads, you should de-serialize the request body yourself, for example: json.loads(request.body).

    (request.body is how you access the raw payload).

提交回复
热议问题