my webapps has two pages
- home: /. it will render my base html template as below
@app.route("/")
def main_page():
return render_template("base.html")
in base.html (jinja2 tempalte), I have a if statement to check variable to hide/unhide a div
{% if value %}
<div id=recipe-value class="form-group value-group">
<label for="value">Value:</label>
<textarea class="form-control" rows="15" name="value-text">{{ value}}</textarea>
</div>
- api /api: it will process request, response with result, then render the base.html with value
@app.route("/api")
def processing():
...
for response in responses:
value = value + response.text
return render_template("base.html", value=value)
with it, my webpage will display the path /api instead /. if I redirect to root page, I will have error for missing value in code. I wonder how we can redirect to the same page with parameters using flask or I must use ajax to do it.