title: Error When Attempting to $ajax post to authorize.net API with XML Data
body: <p>I am currently trying to make a request to the Authorize.net AIM api. I have successfully sent the post in Post Man. The issue I am having has to do with the fact that the posted data has to be in xml. When I try to set the data to xml as shown in the sample below, I receive an error of Unexpected token ILLEGAL. Any help with this error would be great. Additionally if there is a better way to format the xml for the post please let me know I have looked around allot with no success.</p>
  
  <pre><code>$.ajax({
      type     : "POST",
      url      : "https://apitest.authorize.net/xml/v1/request.api",
      data     : "&lt;createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&gt;
    &lt;merchantAuthentication&gt;
      &lt;name&gt;xxxxxxxxxxx&lt;/name&gt;
      &lt;transactionKey&gt;xxxxxxxxxxx&lt;/transactionKey&gt;
     &lt;/merchantAuthentication&gt;
    &lt;refId&gt;123456&lt;/refId&gt;
    &lt;transactionRequest&gt;
      &lt;transactionType&gt;authCaptureTransaction&lt;/transactionType&gt;
      &lt;amount&gt;5&lt;/amount&gt;
      &lt;payment&gt;
        &lt;creditCard&gt;
          &lt;cardNumber&gt;5424000000000015&lt;/cardNumber&gt;
          &lt;expirationDate&gt;1220&lt;/expirationDate&gt;
          &lt;cardCode&gt;999&lt;/cardCode&gt;
        &lt;/creditCard&gt;
      &lt;/payment&gt;
      &lt;order&gt;
       &lt;invoiceNumber&gt;INV-12345&lt;/invoiceNumber&gt;
       &lt;description&gt;Product Description&lt;/description&gt;
      &lt;/order&gt;
      &lt;lineItems&gt;
        &lt;lineItem&gt;
          &lt;itemId&gt;1&lt;/itemId&gt;
          &lt;name&gt;vase&lt;/name&gt;
          &lt;description&gt;Cannes logo &lt;/description&gt;
          &lt;quantity&gt;18&lt;/quantity&gt;
          &lt;unitPrice&gt;45.00&lt;/unitPrice&gt;
        &lt;/lineItem&gt;
      &lt;/lineItems&gt;
      &lt;tax&gt;
        &lt;amount&gt;4.26&lt;/amount&gt;
        &lt;name&gt;level2 tax name&lt;/name&gt;
        &lt;description&gt;level2 tax&lt;/description&gt;
      &lt;/tax&gt;
      &lt;duty&gt;
        &lt;amount&gt;8.55&lt;/amount&gt;
        &lt;name&gt;duty name&lt;/name&gt;
        &lt;description&gt;duty description&lt;/description&gt;
      &lt;/duty&gt;
      &lt;shipping&gt;
        &lt;amount&gt;4.26&lt;/amount&gt;
        &lt;name&gt;level2 tax name&lt;/name&gt;
        &lt;description&gt;level2 tax&lt;/description&gt;
      &lt;/shipping&gt;
      &lt;poNumber&gt;456654&lt;/poNumber&gt;
      &lt;customer&gt;
        &lt;id&gt;99999456654&lt;/id&gt;
      &lt;/customer&gt;
      &lt;billTo&gt;
        &lt;firstName&gt;Ellen&lt;/firstName&gt;
        &lt;lastName&gt;Johnson&lt;/lastName&gt;
        &lt;company&gt;Souveniropolis&lt;/company&gt;
        &lt;address&gt;14 Main Street&lt;/address&gt;
        &lt;city&gt;Pecan Springs&lt;/city&gt;
        &lt;state&gt;TX&lt;/state&gt;
        &lt;zip&gt;44628&lt;/zip&gt;
        &lt;country&gt;USA&lt;/country&gt;
      &lt;/billTo&gt;
      &lt;shipTo&gt;
        &lt;firstName&gt;China&lt;/firstName&gt;
        &lt;lastName&gt;Bayles&lt;/lastName&gt;
        &lt;company&gt;Thyme for Tea&lt;/company&gt;
        &lt;address&gt;12 Main Street&lt;/address&gt;
        &lt;city&gt;Pecan Springs&lt;/city&gt;
        &lt;state&gt;TX&lt;/state&gt;
        &lt;zip&gt;44628&lt;/zip&gt;
        &lt;country&gt;USA&lt;/country&gt;
      &lt;/shipTo&gt;
      &lt;customerIP&gt;192.168.1.1&lt;/customerIP&gt;
      &lt;transactionSettings&gt;
        &lt;setting&gt;
          &lt;settingName&gt;testRequest&lt;/settingName&gt;
          &lt;settingValue&gt;false&lt;/settingValue&gt;
        &lt;/setting&gt;
      &lt;/transactionSettings&gt;
      &lt;userFields&gt;
        &lt;userField&gt;
          &lt;name&gt;MerchantDefinedFieldName1&lt;/name&gt;
          &lt;value&gt;MerchantDefinedFieldValue1&lt;/value&gt;
        &lt;/userField&gt;
        &lt;userField&gt;
          &lt;name&gt;favorite_color&lt;/name&gt;
          &lt;value&gt;blue&lt;/value&gt;
        &lt;/userField&gt;
      &lt;/userFields&gt;
    &lt;/transactionRequest&gt;
  &lt;/createTransactionRequest&gt;",
      dataType : "xml",
      success  : function(msg){
          console.log("success");
      }
      error    : function(msg) {
          console.log("fail");
      }
  });
  </code></pre>