Reputation: 51
I have a small app to test: https://github.com/vmbelizario/phonegap its just a login form who connects to a PHP page and check if the login exist.
The side-server is the auth.php file. The client-side is the js/auth.js who connect to http://myserver.com/auth.php (example) and do the login test.
If i upload in a apache + mysql server, works. But in android, after put the credentials i got only "connecting..." and didnt worked. I tested via adobe builder (build.phonegap.com/apps) build and install in my smartphone and via monaca.io android emulator. Can someone check what is wrong and help me? Thanks!
Upvotes: 0
Views: 90
Reputation: 130
I think you need to use the query string in the url. Try to concatenate the URL with your data string and pass it as a complete url in your ajax call. First try to hit the complete URL with static values in the browser, if it works then that's a solution for your problem. For example: http://myserver.com/[email protected]&password=password&login=
Upvotes: 0
Reputation: 995
Make sure you have the Cordova Whitelist plugin installed.
cordova plugin add cordova-plugin-whitelist This is required for Android and not on iOS or Browser.
Then check your config.xml for lines like these.
<access origin="*"/>
This will allow any network communication from your app. To be more safe you can change this to.
<access origin="YOUR_URL/*" />
This will allow network access only the the URL specified and any subdomains.
See the documentation here.
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/
Upvotes: 1