title: How to add Accept Header with text/csv in jQuery ajax
body: <p>This might be a simple question but I have not yet found the way to sort it out. I would like to download csv file from server (implemented by ASP.NET Web API) by ajax call:</p>
  
  <pre><code>$.ajax({
      type: "GET",
      accepts: "text/csv; charset=utf-8",
      url: "/api/employees",
      success: function (data) {
      }
  });
  </code></pre>
  
  <p>I have put the Accepts header in jQuery ajax like above. But from fiddler, I see:</p>
  
  <p><img src="https://i.stack.imgur.com/wRIws.png" alt="enter image description here"></p>
  
  <p>The Accepts header now turns to <code>Accept: undefined</code>. If I try to put:</p>
  
  <pre><code>    accepts: {
          csv: "text/csv; charset=utf-8"
      }
  </code></pre>
  
  <p>The Accepts Header now turns to: <code>Accept: */*</code></p>
  
  <p><img src="https://i.stack.imgur.com/yfdqt.png" alt="enter image description here"></p>
  
  <p>So I guess that is the main point to make my server returns JSON object rather than CSV file.</p>
  
  <p>How can I make Accepts Header in jQuery ajax correctly? and see in the fiddler should be: 
  <code>Accept: text/csv</code></p>
  
  <p>I am using Chrome.</p>