3
我想問如何讓我的網站包含我搜索到的worh。事情是這樣的:瓶 - 帶搜索詞的網址
http://host/filter?test
我的代碼:
@app.route('/filter', methods=['POST', 'GET'])
def filter():
if request.method == 'POST':
if str(request.form['search_string']) <> '':
api.queryMessage(request.form['search_string'])
return render_template('main.html', search_string=search_string)
而且我的模板,main.html中:
<form name="filters" action="{{ url_for('filter') }}" method=post id="filters">
<div style="position: absolute; top:100px; left:300px">
<p>Search string: <input type=text size=80 title="Match all of the words" name=search_string value="{{search_string}}"></p>
<input type=submit value=Filter/Search onclick=loopSelected();>
<input type="hidden" name="chosen" id="chosen" value="{{chosen}}" />
</div>
</form>
請接受答案,如果你喜歡它:) – HighCat 2012-07-25 10:15:43
非常感謝很多人。 – voyagersm 2012-07-27 12:33:12