【发布时间】:2017-04-07 01:23:29
【问题描述】:
我正在尝试将数组作为参数发送到使用 python 和 django 框架的 api。
这是我用来访问api的客户端代码:
$.ajax(
type: 'POST',
url: 'http://example.com/api/users',
data: {user:{name:'Rohit Khatri', age:20, father_name:'S.K'},type:'info'},
complete: function(response) {
console.log(response);
}
);
这是我试图访问请求参数的视图
def get_users(request):
print(request.POST.get('ids'))
当我尝试访问ids 参数时,它给出了无。
如果有人遇到同样的问题,请帮助我。
【问题讨论】:
标签: python django dictionary parameters request