How to include template dynamically when I click on a button

Hi ,
Good day.

I have been trying to include template dynamically at a specific part of the page, when I click on button. I have multiple buttons, every time I click on different button, different template should load, I tried with ajax and fetch but it’s loading but some other functionality in loaded template got effecting, so is there a way to include like below.

{% url ‘template.html’ %} like this this template.html will vary based on button we clicked

Thanks in advance

First, never lose sight of the fact that these tags only exist in the server. When the page has been rendered and returned to the browser, that tag no longer exists in the html - it has already been replaced by the url.

So the easiest way that I have found to handle something like this is to have a view that takes a parameter. That parameter identifies which template to render and return.

You then define your different buttons to do a get on the url for that view, passing the appropriate value as the parameter.

@KenWhitesell Thanks for the response. I got it. Appreciate for your time