I have this flask app
@app.route('', methods=['POST'])
def my_function():
(...some functions...)
map = some_url
return render_template ("main.html", map = map)
And I want to insert "map" into my JavaScript (.js is in /static):
btn.addEventListener("click", function(){
var newMap = document.createElement("IMG");
newMap.setAttribute("src", "{{map}}");
newMap.setAttribute("width", "300");
newMap.setAttribute("height", "300");
I do a print(map)
before return render_template
and it prints well but newMap
is created but empty, like with no src
.