title: JQuery $.ajax output data format
body: <p>I have the following code I am using to connect to a vender. When run, I am getting back a status code 0. When evaluating using Wireshark, I am finding that the request is failing because of the following:</p>
  
  <p><strong>Error: The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'.</strong> </p>
  
  <p>I saw from the documentation that the dataType setting defines the incoming data only. How do I set the output as JSON?</p>
  
  <p>(please excuse crude coding, this is only a shell at the moment)</p>
  
  <pre><code>    var key         = "xxxxxx";
          $.ajax({
              type        : "POST",
              dataType    : "JSON", 
              url         : "http://url",
              data        : {
                              "CityName":cty,
                              "FirmOrRecipient":name,
                              "LicenseKey":key,
                              "PrimaryAddressLine":s1,
                              "SecondaryAddressLine":s2,
                              "State":st,
                              "ZipCode":zip
              },
              success     : function (data, status, xhr) {
                  var pretty = JSON.stringify(data, null, 4).replace( / /g, '&amp;nbsp;').replace( /\n/g, '&lt;br /&gt;');
                  $('div#results').html(pretty);
              },
              error       : function(jqXHR, textStatus, errorThrown){
                  if (jqXHR.status === 0) {
                      alert('ERROR: \n Failed to connect to PAV.\n Verify Network.');
                  } else if (jqXHR.status == 404) {
                      alert('ERROR: \n Requested page not found. [404]');
                  } else if (jqXHR.status == 500) {
                      alert('ERROR: \n Internal Server Error [500].');
                  } else if (exception === 'parsererror') {
                      alert('ERROR: \n Requested JSON parse failed.');
                  } else if (exception === 'timeout') {
                      alert('ERROR: \n Time out error.');
                  } else if (exception === 'abort') {
                      alert('ERROR: \n Ajax request aborted.');
                  } else {
                      alert('ERROR: \n Uncaught Error.\n' + jqXHR.responseText);
                  }                    
              },
          });
  </code></pre>