title: Django Ajax communication, Django doesn't recognize as being Ajax (using request.is_ajax() )
body: <p>I'm using Ajax with Django. The data is transmitted further but is not recognize as being Ajax. Browser Chrome/Firefox;</p>
  
  <p>To check if the request is done trough ajax, I use:</p>
  
  <pre><code>`request.is_ajax()` method, but this fails, not true, so I checked this method how is working and:
  
  def is_ajax(self):
      return self.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
  </code></pre>
  
  <p>I verified  <code>META.get('HTTP_X_REQUESTED_WITH')</code> and I get <code>None</code>;</p>
  
  <p>I'm think is something with ContentType or I need to set another header. But How ?. My JavaScript is set this way :</p>
  
  <pre><code>xhr.open('post', event.target.action, true);
          xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhr.setRequestHeader("HTTP_X_REQUESTED_WITH", "XMLHttpRequest");
          xhr.send(data));
  </code></pre>
  
  <p>At a further check seems request.Meta doesn't contain Content-type also.</p>