前端发送json字符串

前边

$.ajax({

            url:"/book/",

            type:"POST",

            data: {data:JSON.stringify(POST_DATA),date:CHOSEN_DATE,csrfmiddlewaretoken:'{{ csrf_token }}'},

            success:function(data){

                if(data.status){

                    location.href=""

                }

                else {

                    alert("不能选择其他人已预订的房间")

                    location.href=""

                }

            }

        })

    })


后边:

post_data = json.loads(request.POST.get('data'))

推荐阅读更多精彩内容