title: Determine the data type of the HTTP request
body: <p>I see that with <code>$.ajax()</code> I can use the <code>dataType</code> property to tell jQuery what kind of response I expect from the server, usually <code>json</code>.</p>
  
  <p>But then on the server side, how do I know the data type that was requested?</p>
  
  <p>I understand that normally the server should know what to send based on the content of the request, but my use case is a bit different here. I have an error handler built in PHP and I'd like to know in which format do I output the debug info. In case of fatal/syntax errors, warnings, the script may not even reach the request handler function associated with the request.</p>
  
  <p>There's a <code>CONTENT_TYPE</code> header but apparently it's always <code>application/x-www-form-urlencoded</code>, and it's only sent on <code>POST</code> requests.</p>
  
  <p>And there's a <code>HTTP_ACCEPT</code> header that looks like <code>application/json, text/javascript, */*; q=0.01</code>. Do I need to parse this string?</p>