title: Set "enctype" attribute to "application/json"
body: <p>Here is my code for making POST request:</p>
  
  <pre><code>function post(path, params, method) {
    method = method || "post"; // Set method to post by default if not specified.
  
    // The rest of this code assumes you are not using a library.
    // It can be made less wordy if you use one.
    var form = document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", path);
    form.setAttribute("enctype", "application/json");
    for(var key in params) {
      if(params.hasOwnProperty(key)) {
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", key);
        hiddenField.setAttribute("value", params[key]);
  
        form.appendChild(hiddenField);
      }
    }
  
    document.body.appendChild(form);
    form.submit();
  }
  </code></pre>
  
  <p>I tried to set the <code>Content-type</code> in HTTP header to "application/json" by setting <code>enctype</code> of the form to "application/json". However, it doesn't work.</p>
  
  <p>I saw an <a href="https://darobin.github.io/formic/specs/json/" rel="nofollow">unofficial draft</a> about supporting "application/json" for <code>enctype</code> however it seems not accepted yet..</p>
  
  <p>Does anyone have ideas about how to make a POST request and use <code>JSON</code> instead of <code>formdata</code> as the data format without resorting to AJAX?</p>