我在写一个小应用,这是代码片段。
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>
Flask Code:
@app.route('/test', methods=['POST'])
def test(str):
return str
它给了我这个错误:500 internal error。而当我在调试模式下运行它时,它提示:
test() takes exactly one argument(zero given)