我目前正在使用 Flask,我想要一个“提交”按钮,一旦按下按钮,就会将表单中的数据 POST 到 Python。
我的文本框如下所示:
<form method="POST"> <style>
textarea {
width: 100%;
height: 200px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
font-size: 16px;
resize: none;
}
</style>
Run Code Online (Sandbox Code Playgroud)
我的按钮看起来像这样:
<button type="submit"></button>
Run Code Online (Sandbox Code Playgroud)
我的 run.py 看起来像这样:
@app.route('/', methods=["POST"])
def some_function():
// do stuff
Run Code Online (Sandbox Code Playgroud)
编辑:我无法让 POST 方法工作。按钮出现,即使按下它也没有任何反应。
flask ×1