title: Send AJAX request to Django view with vanilla JS
body: <p>I'm trying to send a <code>GET</code> AJAX request to a Django view using vanilla JS. <code>is_ajax()</code> passes but I could not retrieve the request object properly.</p>
  
  <p>Here is my JS code. With/out <code>JSON.stringify(data)</code> doesn't work.</p>
  
  <pre><code>document.querySelector('#testForm').onsubmit = () =&gt; {
        let data = {category : 'music'};
  
        const request = new XMLHttpRequest();
        request.open('GET', 'test/', true);
        request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
  
        request.onload = () =&gt; {
          const data = JSON.parse(request.responseText);
          console.log(data);
        }
  
        request.send(data);
        return false;
  });
  
  </code></pre>
  
  <p>And here is my Django view:</p>
  
  <pre class="lang-py prettyprint-override"><code>def test(request):
      if request.is_ajax():
          print('Yes!')
          data = {'category': request.GET.get('category', None)}
          return JsonResponse(data)
      else:
          raise Http404
  </code></pre>
  
  <p>It prints <code>Yes!</code> to the terminal but I get back a <code>{category: null}</code> in the console.</p>
  
  <p>This JQuery code works and I get the expected <code>{category: "music"}</code> response:</p>
  
  <pre><code>$.ajax({
          url: 'cart/',
          type: 'GET',
          data: data,
          dataType: 'json',
          success: function (data) {
            console.log(data);
          }
        });
  </code></pre>
  
  <p>I'm wondering what I'm missing in the vanilla JS code or in my Django view.</p>