Answer the question
In order to leave comments, you need to log in
How to add html using ajax jQuery?
Hello everyone, I ask you to suggest a solution to the following problem: the page has a button with the class class = "loadBtn" when clicked, data is added via ajax. The view gives the data as follows
return render(request, 'results.html', {'data': data})
<table>
<thead>
<tr>
<th>Наименование</th><th>Описание</th><th>Цена</th>
</tr>
</thead>
<tbody>
{% for product in data.products %}
<tr>
<th>{{ product.product_name }}</th>
<th>{{ product.product_descript }}</th>
<th>{{ product.product_price }}</th>
</tr>
{% endfor %}
</tbody>
</table>
<form action="" method="get">
<input type="hidden" name="start_url" value="{{ data.next_url }}">
<input type="submit" value="Загрузить следующую страницу" class='loadBtn'>
</form>
document.getElementById(result_form).innerHTML = response;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question