title: Can't connect with server in Phonegap App by CORS request error
body: <p>I've create my app. When i test on desktop or run on PhoneGap IDE it runs ok and connect with server, but when i build my apk and run it on Android, the request failed and launch this menssage:</p>
  
  <p><strong>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>' is therefore not allowed access.</strong></p>
  
  <p>This is my XMLHttpRequest:</p>
  
  <pre><code>sendPost: function(url, data, callback){
  
          var loading = document.getElementById('loading');
          loading.innerHTML = '&lt;p&gt;&lt;/p&gt;';
          loading.classList.add('loading_active');
  
          var params = '';
          var count = Object.keys(data).length;
          for(var i=0; i&lt;count;i++){
              if(i&gt;0){
              params += '&amp;';
              }
              params += Object.keys(data)[i] + '=' + Object.values(data)[i];
          }
  
          var xhr = new XMLHttpRequest();
          xhr.open('POST', url, true);
          xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
          xhr.onreadystatechange = function () {
              if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {
                  var res = JSON.parse(xhr.responseText);
                  if(callback){
                      callback(res);
                  }
              }
          };
          xhr.send(params);
      },
  </code></pre>
  
  <p>And i call it this way:</p>
  
  <pre><code>app.sendPost(url,data,function(res){
      some code.....
      }); // end app.sendPost()
  </code></pre>
  
  <p>And i've include this line in htaccess file:</p>
  
  <pre><code>Header set Access-Control-Allow-Origin "*"
  </code></pre>
  
  <p>But server not allow request from Phonegap (localhost)</p>