【发布时间】:2015-10-12 09:09:40
【问题描述】:
我正在编写一个小应用程序。这是代码sn-p。
Javascript:
<script type="text/javascript">
function filldata()
{
var sample = document.getElementById("filter-select").value;
jQuery.support.cors = true;
$.post("/test",{"filter_type":sample},function(data,status)
{
alert(data);
});
}
</script>
烧瓶代码:
@app.route('/test', methods=['POST'])
def test(str):
return str
它给了我500 internal error。
当我在调试模式下运行它时,它说:
test() takes exactly one argument(zero given)
【问题讨论】:
-
我建议您在这种情况下使用 fiddler,这样您就可以在回复中看到错误。您正在提交名称为
filter_type的字段,但您的服务器端是否有该名称的字段?
标签: javascript python ajax flask