title: Cordova application XmlHttpRequest
body: <p>I am trying to make a POST http request from my cordova application, but it is not working (ios or android), I keep receiving httpRequest.status equals to 0 and httpRequest.responseText is empty, and the server is not reached.</p>
  
  <p>There is plenty of information about this, but I cannot make it work. My config.xml is configure like: </p>
  
  <pre><code>&lt;access origin="*"&gt;
  </code></pre>
  
  <p>I tried as well doing a GET query to google or other known server but is not working either.</p>
  
  <p>This is the code I am using.</p>
  
  <pre><code>function alertContents(httpRequest)
  {
    if (httpRequest.readyState == 4)
    {
      // Everything is good, the response is received
      if ((httpRequest.status == 200) || (httpRequest.status == 0))
      {
        alert("The response was: "  + httpRequest.status + " - " +  httpRequest.responseText);
      } else {
        alert('There was a problem with the request. ' + httpRequest.status + httpRequest.responseText);
      }
    }
  }
  
  function send_with_ajax() {
  alert("Pushing data");
  
    var the_url = 'http://&lt;servier ip&gt;:&lt;port&gt;/service';
    var httpRequest = new XMLHttpRequest();
  
    httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
  
    httpRequest.open("POST", the_url, true);
  
    httpRequest.send(null);
  
  }
  </code></pre>
  
  <p>Per the information online it should work, anybody knows if I am missing something ?,</p>
  
  <p>thanks a lot in advance.</p>