Exercise 2.4C: Transform AJAX Includes to Flask / Jinja Includes

Purpose: Replace AJAX includes with Jinja Includes. One major difference between using server-side Jinja instead of client-side AJAX includes is that Jinja includes occur before the HTML is delivered and AJAX includes occur after the HTML is delivered and rendered. Another major difference is that Jinja includes are built into the render_template function and don't need to be written by you, so your code is smaller overall.

Step 1. Replace AJAX Includes with Jinja Includes

Replace the AJAX include divs -- such as <nav data-include="nav.html"></nav> and <footer data-include="footer.html"></footer> -- with Jinja includes, such as {% include "nav.html" %} and {% include "footer.html" %}.

Step 2. Clean Up AJAX Include Javascript

Now that AJAX includes are no longer needed, clean up by deleting the Javascript AJAX include function definitions.

Test your Project

By the end of this step, your project should work, delivering the same content as Project Part 1.