1π
β
I donβt see that you have a url defined to capture the task_id
I think you need to either put the task_id
in the parameter, so something like url + '?task_id=144
.
If you do this, you need to change your javascript line to look like this:
url: '/update_task/' + '?task_id=144',
or, you need to leave it as is, and add a line to your url conf to capture the parameter:
url(r'^update_task/(?P<task_id>\d+)/$', 'todo.views.update_task', name='update_task'),
and then in your views:
def update_task(request, task_id=None):#if task_id is optional, set it to =None or something
if request.is_ajax():
do stuff here with task_id
also, you will need to take out the task_id = request.GET.get('task_id')
because task_id is not in the GET body.
π€James R
Source:stackexchange.com