Answer the question
In order to leave comments, you need to log in
What is the correct way to pass arguments to Django views using ajax?
I want to make an ajax request to a url that corresponds to a function that accepts (request and pk)
I understand that it is possible to collect such a date and then decompose it into a view, in something like
data = {'csrfmiddlewaretoken': csrftoken, pk: pk };
pk = int(request.POST['pk'])
url(r'^some/(?P<pk>\d+)/add/$', views.some_add, name='some_add'),
url(r'^some_add/$', views.some_add, name='some_add'),
pk = int(request.POST['pk'])
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