If you want to achieve this:
In your Django view:
- By default: show template A.html
- If a certain condition is met (Load_A_Done): show template B.html
When AJAX call is successful in A.html, trigger the Django View with a form parameter load=OK.
In the Django view, check if the load parameter exists. If not, use A.html as the template. If it does, use B.html as the template. Remember to display messages before using B.html
from django.contrib import messages
def viewAB(request):
if request.GET.get("load") == "OK":
messages.info(request, 'A loaded successfully')
return render(request, 'B.html')
else:
return render(request, 'A.html')
In B.html:
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Important: {% endif %}
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}