Answer the question
In order to leave comments, you need to log in
Where can I find an example of submitting an axaj post in django (not a form)?
Hello.
Help me find the simplest example of sending data via ajax, post method for further processing in the view,
(I'm not sending a form), but data from custom attributes in tags.
Answer the question
In order to leave comments, you need to log in
simpleAjax.js
var xhr = new XMLHttpRequest();
xhr.open("POST", '/some-url', true)
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send("param_name=param_val");
def simple_ajax(request):
if request.method == 'POST':
print(request.POST.get('param_name'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question