title: Differences between contentType and dataType in jQuery ajax function
body: <p>I have the following Jquery callback function and I have a litle doubt about it (I don't know very well Jquery):</p>
  
  <pre><code>$("form.readXmlForm").submit(function() {
      // Riferimento all'elemento form che ha scatenato il submit 
      var form = $(this);
      // Variabile che contiene il riferimento al bottone clickato 
      var button = form.children(":first");
  
      $.ajax({        // Viene eseguita la chiamata AJAX 
          type: "POST", // Tipo di richiesta: POST 
          // URL verso quale viene inviata la richiesta
          url: form.attr("action"),    
          // Dati XML inviati: 
          data: "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?&gt;&lt;javaBean&gt;&lt;foo&gt;bar&lt;/foo&gt;&lt;fruit&gt;apple&lt;/fruit&gt;&lt;/javaBean&gt;", 
          // Tipo di media type accettabile dalla response: 
          contentType: "application/xml", 
          dataType: "text", 
  
          success: function(text) { 
              MvcUtil.showSuccessResponse(text, button); 
          }, 
  
          error: function(xhr) { 
              MvcUtil.showErrorResponse(xhr.responseText, button); 
          }
      });
  </code></pre>
  
  <p>As you can see this function simply execute an AJAX Request to the backend setting the parameter for this request.</p>
  
  <p>I have set that I am sending the request towards an URL, that the request is a POST request and that the data that I am sending are the following string:</p>
  
  <p>"barapple"</p>
  
  <p>I have some difficulties to understand what is the differences between <strong>contentType</strong> and <strong>dataType</strong></p>
  
  <p>I think that <strong>contentType</strong> specify the type of data that are acceptable recived in the HTTP Response, is it right?</p>
  
  <p>And dataType? What say? The type of data that I am sending in the HTTP Request?</p>
  
  <p>In this case is is "text" because I am sending a textual string that rappresent XML code?</p>