title: What is the syntax to do a cross-domain XMLHTTPREQUEST to an FTP server?
body: <p>I have an webDav CORS plugin, which I can use to POST/PUT/GET/REMOVE/ALLDOCS files on a webDav server. </p>
  
  <p>I now want to do the same for FTP, but I'm struggling to get the <code>xmlhttprequest</code>-syntax to work (I'm just getting error <code>0</code> ).</p>
  
  <p>This page on <a href="https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest?redirectlocale=en-US&amp;redirectslug=XMLHttpRequesty">Mozilla</a> says it's possible to use <code>xmlhttprequests</code> for file and ftp as well, but I cannot find a working example or tutorial anywhere.</p>
  
  <p>This is what I'm trying, which returns <code>access to restricted URI denied</code></p>
  
  <pre><code>function reqListener () {
    console.log(this.responseText);
  }
  
  var oReq = new XMLHttpRequest();
  oReq.onload = reqListener;
  oReq.open("GET", "ftp://&lt;username&gt;:&lt;passeword&gt;@mydomain.de/folder/test.txt", true);
  oReq.send();
  </code></pre>
  
  <p>I also tried a regular Ajax request</p>
  
  <pre><code>$.ajax({
    url: "ftp://sharedspace.domain.provider.com/folder/test.txt",
    type: "GET",
    async: true,
    dataType: "text",
    crossdomain : true,
    headers : {
      user: "&lt;username&gt;",
      password: "&lt;password&gt;"
    },
    success: function(e){
      console.log("success");
      console.log(e);
    },
    error: function(e){
      console.log("error");
      console.log(e);
    },
  }); 
  </code></pre>
  
  <p>which also does not work, returning <code>0</code> status code.</p>
  
  <p><strong>Question</strong>:<br>
  What is the correct syntax to do a cross-domain <code>XMLHTTPREQUEST</code> for <code>FTP</code>.</p>
  
  <p>Thanks! </p>
  
  <p><strong>EDIT:</strong><br>
  The only useful link I found is this page <a href="http://www.webdeveloper.com/forum/showthread.php?229797-How-do-Ajax-to-FTP-server">here</a>, but it's just bits and pieces of information and I couldn't puzzle them together.</p>
  
  <p><strong>EDIT</strong><br>
  Maybe also useful <a href="http://markos.gaivo.net/blog/?p=109">link</a></p>