Skip to content Skip to sidebar Skip to footer

Change Jinja Child Template In Response To Html Event

Suppose I have a base template base.html:
{% block content %} {% endblock %}

Solution 1:

You noted properly, that the jinja2 template is rendered server side while JavaScript runs in your browser.

So JavaScript has no direct chance to affect how is the template rendered.

There could be some solutions, e.g.

Generate both versions of content

Generate them hidden, let your JavaScript show just one of them

AJAX - pull proper content from JavaScript

JavaScript would detect what is to be inside and using AJAX call would pull what is needed.

Post a Comment for "Change Jinja Child Template In Response To Html Event"