title: xmlHttpRequest status = 0
body: <p>I have a website (wagtail CMS) running at AWS at domain:8000 and my API running at domain:8801</p>
  
  <p>On my webpage I try to get some info from API by using JS (Access-Control-Allow-Origin header is set correctly at API, it's a django-based app)</p>
  
  <p>Unfortunately the following code returns only xhr.status = 0 and empty responseText no matter what I try to access.</p>
  
  <p>When I put domain:8000 at xhr.open('GET','<a href="http://domain:8000" rel="nofollow">http://domain:8000</a>',true) everything works just fine, I see my html code. </p>
  
  <pre><code>function load() {
  var xhr = new XMLHttpRequest();
  xhr.open('GET', 'http://domain:8801/api/', true);
  xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
  xhr.send();
  if (xhr.status != 200) {
    alert( "ERR" ); --always ERR in browser
      } 
      else {
          alert( "SUCCESS" );
      }
  }
  </code></pre>
  
  <p>On the API side I see all my requests, status=200 in server console.</p>