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:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
This is my XMLHttpRequest:
sendPost: function(url, data, callback){
        var loading = document.getElementById('loading');
        loading.innerHTML = '<p></p>';
        loading.classList.add('loading_active');
        var params = '';
        var count = Object.keys(data).length;
        for(var i=0; i<count;i++){
            if(i>0){
            params += '&';
            }
            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 && xhr.status === 200) {
                var res = JSON.parse(xhr.responseText);
                if(callback){
                    callback(res);
                }
            }
        };
        xhr.send(params);
    },
And i call it this way:
app.sendPost(url,data,function(res){
    some code.....
    }); // end app.sendPost()
And i've include this line in htaccess file:
Header set Access-Control-Allow-Origin "*"
But server not allow request from Phonegap (localhost)
 
    