【发布时间】:2014-10-07 06:45:05
【问题描述】:
我正在尝试通过 POST 将数据发送到 python 脚本,但无法读取它。用户界面在 AngularJS 中。我见过类似的问题,但他们要么不使用 AngularJS,要么不使用 POST。
Angular 代码:
$scope.send = function(){
$data = {
"tableData":$scope.personsSelected
}
$postData = JSON.stringify($data);
Services.post('testbed.cgi', $postData);
}
Python 代码:
formData = cgi.FieldStorage()
print json.dumps(formData)
错误信息:
TypeError: FieldStorage(None, None, []) is not JSON serializable
我尝试将内容类型设置为 application/x-www-form-urlencoded 但无济于事。我在这里错过了什么?
【问题讨论】:
标签: javascript python angularjs post