When I try to send an array to Django via Ajax (jQuery)
JavaScript code:
new_data = ['a','b','c','d','e'];
$.get('/pythonPage/', {'data': new_data},function(data){});
and I try to read the array:
Python:
request.GET.get("data[]")
I get only the last array value:
'e'
What am I doing wrong?
You’re looking for the
QueryDict‘sgetlisthttps://docs.djangoproject.com/en/2.0/ref/request-response/#django.http.QueryDict.getlist