Flask向模板中JS传值简便方式

后台传值:

return render_template('statistics/numberofuserlogin/login_number.html', result_json = json.dumps(result))

模板中JS取值:

js_object = eval('{{result_json|safe }}')

参考链接:

https://www.cnblogs.com/lazyboy1/p/5015111.html  

猜你喜欢

转载自www.cnblogs.com/weswes/p/10220890.html