how to send an array to django code example
Example 1: ajax django send array
from django.http import HttpResponse
def edit_lists(request):
tasks = request.POST.getlist('tasks[]')
return HttpResponse('Success')
Example 2: ajax django send array
$('.btn-group').find('#mark_as_done').on('click', function() {
var tasks = grab_selected();
$.ajax({
type: 'POST',
url: '/edit_lists/',
data: {'tasks[]': tasks},
});
});