title: Javascript : Send JSON Object with Ajax?
body: <p>Is this possible?</p>
  
  <pre><code>xmlHttp.send({
      "test" : "1",
      "test2" : "2",
  });
  </code></pre>
  
  <p>Maybe with: a header with <code>content type</code> : <code>application/json</code>?:</p>
  
  <pre><code>xmlHttp.setRequestHeader('Content-Type', 'application/json')
  </code></pre>
  
  <p>Otherwise I can use:</p>
  
  <pre><code>xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
  </code></pre>
  
  <p>and then <code>JSON.stringify</code> the JSON object and send it in a parameter, but it would be cool to send it in this way if it's possible.</p>