title: Django Post request not receiving data
body: <p>I've spent hours looking up this issue with no avail.</p>
  
  <p>I am having issue with post data from an html page I am sending <code>{'username': 'username'}</code> but when I do request.POST.get('username') it returns none, I alos tried <code>{username, 'username'}</code></p>
  
  <pre><code>def test_post(request):
      if request.method == 'POST':
          print(request.POST.get('username'))
          return HttpResponse("Good!")
      else:
          return HttpResponse("Bad.")
  </code></pre>
  
  <p>Console Development Server</p>
  
  <pre><code>None &lt;&lt;&lt;&lt;
  
  [12/Feb/2018 19:39:53] "POST /test_post HTTP/1.1" 200 5
  (edited)
  </code></pre>
  
  <p>I am sending the data as <code>{'username': 'username'}</code>
  That works correctly how come I am unable to get it to show up?</p>
  
  <p>This is the Javascript code that calls from the page:</p>
  
  <pre><code>document.getElementById('submit').addEventListener('click', function(e) {
      e.preventDefault();
     var username = document.getElementById("username").value;
  
     data = {username: username};
     console.log(data);
     var request = new XMLHttpRequest();
     request.open('POST', '/getuser', true);
     request.setRequestHeader('Content-Type', 'x-www-form-urlencoded');
     request.send(data);
  });
  </code></pre>