title: JQuery: post FormData AND csrf token together
body: <p>Is the <code>data:..</code> line below correct? I want to post the form data AND csrf token to a Django view function. </p>
  
  <pre><code>$('#file-upload').on('change', function () {
      var currentpath = window.location.pathname;
      var formData = new FormData($('form')[0]);
      $.ajax({
              url: currentpath,  //server script to process data
              type: 'POST',
              data: {formData, 'csrfmiddlewaretoken': '{{ csrf_token }}'},
              cache: false,
              contentType: false,
              processData: false
          });
  });
  </code></pre>