title: Different ways to pass XML via jQuery AJAX
body: <p>I'm facing a problem to get return value (content-type: "text/xml"). I'm able to get return value by direct access this URL:</p>
  
  <p><code>https://[domain_name]/myfolder/myapi/?xml=&lt;xml version='1.0'&gt;&lt;MyTasks&gt;&lt;Search&gt;&lt;/Search&gt;&lt;/MyTasks&gt;</code></p>
  
  <p>Please help me to correct these alternatives if it is wrong (called in HTML located in <code>MyFolder</code>) because it always alert 'Failed'.</p>
  
  <pre><code>$.ajax({
      type     : "GET",
      url      : "interface/?xml=&lt;xml version='1.0'&gt;&lt;MyTasks&gt;&lt;Search&gt;&lt;/Search&gt;&lt;/MyTasks&gt;",
      dataType : "text/xml",
      success  : function(msg){
          alert('Success');
      }
      error    : function(msg) {
          alert('Failed');
      }
  });
  </code></pre>
  
  <p>or...</p>
  
  <pre><code>$.ajax({
      type     : "POST",
      url      : "interface/",
      data     : { xml: escape("&lt;MyTasks&gt;&lt;Search&gt;&lt;/Search&gt;&lt;/MyTasks&gt;") },
      dataType : "text/xml",
      success  : function(msg){
          alert('Success');
      }
      error    : function(msg) {
          alert('Failed');
      }
  });
  </code></pre>
  
  <p>Thank you.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>The interface has to be accessed by <code>https</code>, so I changed <code>url</code> param to absolute URL. I also have to use <code>"xml"</code> not <code>"text/xml"</code> as its <code>dataType</code>. It results Success, thank you.</p>