title: Network Error on cross domain ajax call using XMLHttpRequest
body: <p>This is how I set the <code>xmlhttp</code>:</p>
  
  <pre><code>xmlhttp = new XMLHttpRequest();
  </code></pre>
  
  <p>I followed the instructions in <a href="https://stackoverflow.com/questions/9713058/sending-post-data-with-a-xmlhttprequest">this post</a> that explains how to send a POST request.</p>
  
  <pre><code>xmlhttp.open("POST", url, false);//false means synchronous
  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlhttp.withCredentials = true;
  xmlhttp.send(postData);// This line throws Network Error exception.
  </code></pre>
  
  <p><strong>Notes:</strong></p>
  
  <p>This URL is a <code>.asmx</code> web service.</p>
  
  <p>This web service works fine, when I try to get data from it using the browser.</p>
  
  <p>When I try running this code in the same domain where the web service is located, the code runs fine, and returns the data as I expect.</p>
  
  <p>Most of my code, is based on async calls in which the same problem occurs, this example is sync only for simplicity.</p>
  
  <p><strong>My problem:</strong></p>
  
  <p>When I try to run this code from localhost, the line that I mentioned throws an exception.
  I checked the actual response that returns from the web service, and turns out that <strong>it contains the data it should</strong>.</p>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: private, max-age=0
  Server: Microsoft-IIS/7.5
  X-AspNet-Version: 4.0.30319
  Persistent-Auth: true
  X-Powered-By: ASP.NET
  Access-Control-Allow-Origin: *
  Access-Control-Allow-Methods: GET, POST
  Access-Control-Allow-Headers: Origin,cache-control,content-type,man,messagetype,soapaction
  Date: Mon, 09 Dec 2013 18:20:03 GMT
  Content-Length: 563
  
  The actual data exists here in the response....
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>When I use async call, <strong>the request is ended with status 0</strong> but it still has the data.</p>