Why is the ajax request does not work in render views.py django?

On the html page is input and ajax to it, which transmits a value in views.py
<input type="text" name="zayavka_number" required="" id="id_zayavka_number" placeholder="enter the application number to display" onchange="sortComplectTable(value)">
the <script> sortComplectTable function(value) {
$.ajax({
 url: "/sort_complect_table",
 type: "POST",
 dataType: "json",
 data: {
 value: value,
 csrfmiddlewaretoken: '{{ csrf_token }}'
},
});
 }</script>

value comes to def sort_complect_table fine here:
def sort_complect_table(request):
 sort_zayavka = request.POST.get('value')
print(value)
 sort_compl_table = ComplectTable.objects.filter(zayavka_number=sort_zayavka)
 return render(request, 'journal/komplekt_table.html', {"full_compl_table" : sort_compl_table})

everything you need is done, but as it comes to render anything on the page does not change. Tell me what's the matter? I only first tried ajax and maybe somewhere not understood the principle. Thank you.
April 19th 20 at 12:15
1 answer
April 19th 20 at 12:17
Well, the ajax request returned to you by the render (it works), and then you with this is not doing anything.

Find more questions by tags DjangoAJAX