title: Sending data to the server via XMLHttpRequest in Django
body: <p>I am designing a web app where users can post content to a feed.
  I usually send the post and the post data to the server via an XMLHttpRequest.</p>
  <pre><code>request = new XMLHttpRequest()
      var user = 'current user'
      var post = 'some text'
      request.open(&quot;POST&quot;, &quot;/sent_new_post?x=&quot; + post + &quot;&amp;user=&quot; + user)
      request.setRequestHeader(&quot;X-CSRFToken&quot;, csrftoken);
      request.setRequestHeader(&quot;Content-Type&quot;, &quot;text/plain;charset=UTF-8&quot;);
      request. onload = () =&gt; { // do stuff when response comes back }
      request.send()
  </code></pre>
  <p>On the server I then access the data with</p>
  <pre><code>x = request.GET['x']
  </code></pre>
  <p>But I have run into some problems using this method especially when the post text contains an '#'.
  I was wondering if I can send the data using</p>
  <pre><code>request.send(data)
  </code></pre>
  <p>But I don't know how to access that data in the view function...
  How can I access data in my view function that has been send to the server using request.send(data)????</p>