python tornado ajax传递数组array参数无法解析

本文共有366个字,关键词:

问题:jquery的$.post()方法传递数组参数,在python中无法获取
解决:将数组参数变字符串
方法:
var afile = [];
afile.push('{"fname":"'+$(this).attr('id')+'", "oname":"'+$(this).text()+'"}');
sargs['afile'] = afile.toString();
$.post('/bk/api/add/schedule',sargs,function(data){ console.log('ok'); },'json');
服务端:
afile = self.get_argument('afile','')
afile_list = json.loads('['+afile+']')

版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。
添加新评论
暂无评论