title: Cordova XMLHttpRequest.status=0 when try to get data from web service on Android device
body: <p>I got XMLHttpRequest.status=0 when try to get data from my web service on Android device via Cordova 6.4.0. Request works on Nexus Emulator, but not on real device.</p>
  
  <pre><code>  $.ajax({
              url: 'http://localhost:58511/api/OrdersApi',  
              success: function (data) {
                    WriteResponse(data);
              },
              error: function (XMLHttpRequest, textStatus, errorThrown) {
  
                  alert(XMLHttpRequest.status + '\n' + XMLHttpRequest.responseText + '\n' + errorThrown);
              }
          });
  </code></pre>
  
  <p>If I replace URL just for testing to Nasa API: <code>url: "https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY",</code> It works on device. Web service side code:</p>
  
  <pre><code>[AllowCrossSiteJson]
  [EnableCors(origins: "*", headers: "*", methods: "*")]
  public class OrdersApiController : ApiController
  {
   // code for get CRUD operations
  }
  </code></pre>
  
  <p>That's what i put to  in index.html regarding CSP:</p>
  
  <pre><code>&lt;meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"&gt;
  </code></pre>
  
  <p>Here what I tried to do in config.xml: </p>
  
  <pre><code> &lt;plugin name="cordova-plugin-whitelist" version="1" /&gt;
    &lt;access origin="http://127.0.0.1*"/&gt;
    &lt;access origin="http://localhost:58511*"/&gt;
    &lt;access origin="*" /&gt;
    &lt;allow-intent href="http://*/*" /&gt;
    &lt;allow-intent href="https://*/*" /&gt;
    &lt;allow-intent href="tel:*" /&gt;
    &lt;allow-intent href="sms:*" /&gt;
    &lt;allow-intent href="mailto:*" /&gt;
    &lt;allow-intent href="geo:*" /&gt;
    &lt;platform name="android"&gt;
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="sms:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
      &lt;allow-intent href="market:*" /&gt;
      &lt;access origin="http://127.0.0.1*"/&gt;
      &lt;access origin="http://localhost:58511*"/&gt;
      &lt;access origin="*" /&gt;
    &lt;/platform&gt;
  </code></pre>