There should be no cross-origin issues in phonegap / cordova if you correctly configure the source code in the config.xml file.
Itβs normal that you have this message when testing in a browser if you missed some CORS headers. Try adding:
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST');
But again, you do not need these headers for the phone application.
When you do echo "hi"; , yours does not send json, but sends the text "hello". (just a json entry in the header does not format what you echo).
I think you should either use $.get in javascript, and remove the header('Content-Type: application/json'); from php so that the application expects plain text or modifies your php to really send JSON.
for ex:
echo "{message:\"hi\"}";
Quickfix
source share