No offense, but your second example can't be working. PhoneGap is not a PHP server, so it wouldn't get much of use. What you're probably getting instead is the source code of the PHP script, which is probably not what you want.
Also, don't change res/xml/config.xml -- that's not yours to mess with. Change your project's config.xml instead (just above your www directory).
Have you added (or do you have) a CSP meta tag (Content-Security-Policy)? If you haven't, you need to add one. If you have one, show us what it is (it's in your index.html).
Also make sure that your device can reach your server. Try the URL in a web browser to verify reachability. If it can't connect, make sure that the server isn't blocking your connections. (If you're using your dev machine, your device needs to be on the same physical network.)
Correct: You're right about the first point. Hehehe.
I'm using a console where I get the logs (console.log), I can see everything, but not any result from the request, except if I use the second.
So my problem is I can't make requests using http:// in the url. All the sites I tried are available and working. I do the same call using another application, not in cordova, and it works perfectly.
I do have the Content-Security-Policy meta tag.
And about the last thing, I'm using my dev machine and both are on the same physical network.
Thanks for your response.
1. Make sure you can access your dev machine from a browser on the device (like Safari or Chrome). If you can't make sure you are letting connection requests through your firewall.
2. Post your CSP meta tag so we can validate it.
Yes. I can access the url from the browser on the device.
This is the CSP content:
<meta http-equiv=“Content-Security-Policy” content=“default-src ‘self’ data: gap” https://ssl.gstatic.com; style-src ‘self’ ‘unsafe-inline’; media-src *”>
<meta http-equiv=“Content-Security-Policy” contnet=“default-src ‘self’ http:”>