title: How to send object that contains array via AJAX POST in Django
body: <p>I am trying to send a object with an array inside of it via an AJAX POST in Django when the user clicks a button. I am following the instructions on the <a href="https://docs.djangoproject.com/en/1.9/ref/csrf/" rel="nofollow">Django docs</a> have hit a snag. I am attempting to see a specific indice in the array using <code>logger.debug()</code> in the view and am not able to access the contents. How do I access that specific element in the array?</p>
  
  <p><strong><em>My AJAX...</em></strong></p>
  
  <pre><code>var tags_selected = [1,2,3,4]
  
  function getCookie(name) {
      var cookieValue = null;
      if (document.cookie &amp;&amp; document.cookie != '') {
          var cookies = document.cookie.split(';');
          for (var i = 0; i &lt; cookies.length; i++) {
              var cookie = jQuery.trim(cookies[i]);
              // Does this cookie string begin with the name we want?
              if (cookie.substring(0, name.length + 1) == (name + '=')) {
                  cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                  break;
              }
          }
      }
      return cookieValue;
  }
  
  var csrftoken = getCookie('csrftoken');
  
  function csrfSafeMethod(method) {
      // these HTTP methods do not require CSRF protection
      return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
  }
  
  $.ajaxSetup({
      beforeSend: function(xhr, settings) {
          if (!csrfSafeMethod(settings.type) &amp;&amp; !this.crossDomain) {
              xhr.setRequestHeader("X-CSRFToken", csrftoken);
          }
      }
  });
  
  $("#filter").click(function(){
    $.ajax({
      type: 'POST',
      url: "/pensieve/filtertags",
      data: {'tags': tags_selected},
      success: function(res){
        console.log(res)
      },
      dataType: "json"
    });
  })
  </code></pre>
  
  <p><strong><em>My View...</em></strong></p>
  
  <pre><code>def filter_tags(request):
      logger.debug(request.POST)
      return HttpResponse(json.dumps({'response': 111}), content_type="application/json")
  </code></pre>
  
  <p><strong><em>My DEBUG log in my terminal...</em></strong></p>
  
  <pre><code>DEBUG - 2016-05-06:17:15:50 - &lt;QueryDict: {u'tags[]': [u'142', u'122', u'138']}&gt;
  </code></pre>