0
我有這個簡單的形式..我在那裏取了來自用戶的輸入像下面表單提交無效?
<form action="/data" autocomplete="on" method="POST">
<input id="search" name="search" type="text" placeholder="Search for song or artists..">
<input id="search_submit" value="Submit" type="submit">
</form>
,一切都工作正常..
現在..我想滑塊添加到它,併發送滑塊值爲python。 我該怎麼做?
我修改的形式是:
<form action="/data" autocomplete="on" method="POST">
<input id="search" name="search" type="text" placeholder="Search for song or artists..">
<input type="range" min="-1" max="1" value="0" step="0.05" onchange="showValue(this.value)" /><input id="search_submit" value="Submit" type="submit">
<span id="range" style="color:#BDBDBD">0</span>
</form>
但它不工作,我得到
Bad Request
The browser (or proxy) sent a request that this server could not understand.
編輯
@app.route("/data", methods=['POST'])
def entry_post():
query = request.form["search"]
print request.form["range"] # I just added this line in the code
發佈代碼表單/數據。 – CyberJunkie
@CyberJunkie:請看看編輯 – Fraz
我認爲你錯過了在你的html – eugecm