相关疑难解决方法(0)

Django:重建通过$ .post发送的结构化参数

我正在发送带有结构化后期数据的Ajax请求(带有jQuery):

$.post(
    myUrl,
    {
         items: [{code: 'a', description: 'aaa'},
                {code: 'b', description: 'bbb'}]
    })
Run Code Online (Sandbox Code Playgroud)

我看到的request.POST是:

<QueryDict: {u'items[0][code]': [u'a'],
             u'items[0][description]': [u'aaa'],
             u'items[1][description]': [u'bbb'],
             u'items[1][code]': [u'b']}>
Run Code Online (Sandbox Code Playgroud)

如何处理获取原件的请求items?

(注意request.POST.get('items')不起作用)

django ajax jquery post

2
推荐指数
2
解决办法
4200
查看次数

标签 统计

ajax ×1

django ×1

jquery ×1

post ×1