Answer the question
In order to leave comments, you need to log in
Python Django how to create link url in ajax method?
There is a link in the template
<a class="lazy_ajax" href="{% url 'news:lazy_ajax' %}" data-page="2">Показать еще</a>
let button = $('a.lazy_ajax');
button.click(function () {
let link = $(this);
let page = link.data('page');
$.ajax({
type: 'GET',
url: $(this).attr('href'),
Answer the question
In order to leave comments, you need to log in
button.click(function(event) {
event.preventDefault();
...
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question