flask - 如何为我的传单函数引用 app.py 中的变量?
问题描述
这是 app.py 的代码:
def index():
if request.method=='POST':
time=request.form.get("time")
return render_template("result.html", time=time)
else:
return render_template("mainpage.html")
我想在我的 result.html 代码中引用时间变量,这就是我所做的:
building = "https://data.calgary.ca/resource/c2es-76ed.geojson?issueddata=" + time
fetch(building)
.then(function(response) {
return response.json();
})
.then(function(data) {
L.geoJSON(data).addTo(mymap);
});
url("https://data.calgary.ca/resource/c2es-76ed.geojson?issueddata=") 加上时间变量将是 geoJSON 的完整 url。然而,我写的代码什么也没做。有人能帮助我吗?
解决方案
没关系,我只是想我必须放“{{time}}”而不是时间
推荐阅读
- r - 如何在 MCA 分析中使用“ind.sup”?
- java - 从 Excel 文件中读取数据在 java 中,文件路径的工作方式与应有的不同
- npm - 运行安装脚本时 NPM 不可用
- spotfire - Spotfire 中带 Datediff 的整数函数
- typescript - TypeScript:如何设置解构对象的类型?
- twitter-bootstrap-3 - 引导 col-xs-* 不工作
- google-bigquery - 使用 BigQuery 对日期数组执行子查询
- javascript - .shift() 显然不再存在
- angular - 如何使用 angular2-jwt 在 Angular 5 中实现 CanActivate?
- openshift - Openshift 在线错误 - “零节点可用”