Passing list of values to django view via jQuery ajax call

You can access this array by request.POST.getlist(‘terid[]’) in the view

in javascript:

$.post(postUrl, {terid: values}, function(response){
    alert(response);
});

in view.py:

request.POST.getlist('terid[]')

It works perfect for me.

Leave a Comment