Answer the question
In order to leave comments, you need to log in
How to substitute values in a template when accessing via ajax?
I have an html page in my django application (its code is not required), here, when you click on the subscriber button, the server is contacted via ajax, which will return the html code for insertion. The question is how to make it so that when accessing the server, on the side of the latter, the html file is read and returned, given that there are parameters inside?
The html itself:
{% load my_filter %}
<div class="block_author">
<a href="">
<!-- аватарка -->
<img class="img_avatar" src="{{ MEDIA_URL}}{{ q.avatar }}">
</a>
<!-- текстовая информация -->
<div class="block_info" href="">
<!-- ссылка на профиль автора -->
<a href="">
<!-- имя -->
<h4 class="name item">{{ q.name }}</h4>
<!-- рейтинг -->
<span class="respect item"><i class="fas fa-award"></i>{{ list_respect|MF_list_index:forloop.counter0 }}</span>
</a>
<!-- кнопка подписаться -->
<a class="subscribe mimi_button" href="">Подписаться</a>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Just like with a regular request - call render, return the result.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question