python3.x - How to parse python django when passing json to the backend through ajax
过去多啦不再A梦
过去多啦不再A梦 2017-06-12 09:23:52
0
2
738

My json content is like this:

{
    "type":"user",
    "ifor":[
        {
            "id":001,
            "name:"lison"
        },
        {
            "id":002,
            "name":"wei"
        }
    ]
}

In JS, I use the ajax method of jquery to pass it, and write it like this:

$.ajax("url",{
    type:"post",
    data:{
        type:"user",
        ifor: [
            {
                id:001,
                name:"lison"
            },
            {
                id:002,
                name:"wei"
            }
        ]
    },
    success:function(){}
})

Mine is python3.6, and django is 1.11.1. How should I receive it in views.py in django? I checked a lot online, some said json.loads(request.body), some said simplejson.loads(request.raw_post_data), but they all seemed to have problems. Could you please tell me how to receive and parse it

过去多啦不再A梦
过去多啦不再A梦

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!