title: Passing list of values to django view via jQuery ajax call
body: <p>I'm trying to pass a list of numeric values (ids) from one web page to another with jQuery ajax call. I can't figure out how to pass and read all the values in the list. I can successfully post and read 1 value but not multiple values. Here is what I have so far:</p>
  
  <p><strong>jQuery:</strong></p>
  
  <pre><code>var postUrl = "http://localhost:8000/ingredients/";
  $('li').click(function(){
      values = [1, 2];
      $.ajax({
          url: postUrl,
          type: 'POST',
          data: {'terid': values},
          traditional: true,
          dataType: 'html',
          success: function(result){
              $('#ingredients').append(result);
              }
      });       
  });
  </code></pre>
  
  <p><strong>/ingredients/ view:</strong></p>
  
  <pre><code>def ingredients(request):
      if request.is_ajax():
          ourid = request.POST.get('terid', False)
          ingredients = Ingredience.objects.filter(food__id__in=ourid)
          t = get_template('ingredients.html')
          html = t.render(Context({'ingredients': ingredients,}))
          return HttpResponse(html)
      else:
          html = '&lt;p&gt;This is not ajax&lt;/p&gt;'      
          return HttpResponse(html)
  </code></pre>
  
  <p>With Firebug I can see that POST contains both ids but probably in the wrong format (terid=1&amp;terid=2). So my ingredients view picks up only terid=2. What am I doing wrong?</p>
  
  <p><strong>EDIT:</strong>
  To clarify, I need the ourid variable pass values [1, 2] to the filter in the ingredients view.</p>