你为什么需要这个职位的功能?您可以在使用重定向从用户获取值之后简单地加载页面。
下面是一个示例如何实现。我模拟了一个类似的场景。对于我需要
application.py:如路由控制器
index.html:作为主模板
evaluasiModelKlasifikasi.html:作为重定向模板
application.py:
import json
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def show_index():
return render_template("index.html")
@app.route('/evaluasiModel/')
def evaluasiModel(metodeSkoring):
return render_template("evaluasiModelKlasifikasi.html", hasilSkoring = metodeSkoring)
if __name__ == '__main__':
app.run(debug=True)
index.html:
IndexGet score
$(document).ready(function(){
$("#get_button").on("click",function(){
var skoring = $("#mentodeNegasi").val();
window.location.href = '/evaluasiModel/'+skoring;
})
})
evaluasiModelKlasifikasi.html
evaluasiModelhasilSkoring: {{ hasilSkoring }}
输出:
索引页:
重定向后:
示范: