title: Jquery - How to make $.post() use contentType=application/json?
body: <p>I've noticed that when using $.post() in jquery that the default contentType is application/x-www-form-urlencoded - when my asp.net mvc code needs to have contentType=application/json</p>
  
  <p>(See this question for why I must use application/json: <a href="https://stackoverflow.com/questions/2792603/aspnet-mvc-why-is-modelstate-isvalid-false-the-x-field-is-required-when-that">ASPNET MVC - Why is ModelState.IsValid false &quot;The x field is required&quot; when that field does have a value?</a>)</p>
  
  <p>How can I make $.post() send contentType=application/json? I already have a large number of $.post() functions, so I don't want to change to $.ajax() because it would take too much time</p>
  
  <p>If I try</p>
  
  <pre><code>$.post(url, data, function(), "json") 
  </code></pre>
  
  <p>It still has contentType=application/x-www-form-urlencoded.  So what exactly does the "json" param do if it does not change the contenttype to json?</p>
  
  <p>If I try</p>
  
  <pre><code>$.ajaxSetup({
    contentType: "application/json; charset=utf-8"
  });
  </code></pre>
  
  <p>That works but affects every single $.get and $.post that I have and causes some to break. </p>
  
  <p>So is there some way that I can change the behavior of $.post() to send contentType=application/json?</p>