我有一个使用flask的python应用程序,其核心路径如下:
@app.route('/test_limit', defaults={'page':1})
@app.route('/test_limit/page/<int:page>')
def test_results_limit(page):
perpage=10
startat=page*perpage
results = []
cursor = db.cursor()
cursor.execute('SELECT * from pi_fb_limit limit %s, %s;', (startat,perpage))
table = list(cursor.fetchall())
return render_template('results_limits.html', table=table)
@app.route('/infringement/FB/<int:id>')
def infringement(id):
cursor = db.cursor()
cursor.execute('UPDATE p_test_search SET infringement = ''TRUE'' WHERE ID = %s', (id))
db.commit()
return render_template('results_limits.html')
在我的HTML文件“result_限制.html“我有一个HTML代码迭代MySQL资源:
^{pr2}$一切正常,但我的问题是,当上面的按钮正常呼叫路线时@应用程序路径('/involution/FB/'),浏览器被重定向到 结果_限制.html. 相反,我希望避免任何重定向,并保持在同一页上,每一行按钮都在创建post(更新记录)。在
有什么建议吗? 谢谢你 雷格斯 SL公司
您需要使用JavaScript提交数据,而无需重新加载页面。在
比如:
^{pr2}$相关问题 更多 >
编程相关推荐