I am developing a hybrid app using phonegap. All my html,css,js files reside in the mobile phone itself. Now, How can I make a call to a server to send/receive data from mobile? Using Ajax if I test locally on my desktop, I get this error!
"XMLHttpRequest cannot load http://domain1.com/test/login.php. Origin
http://localhost is not allowed by Access-Control-Allow-Origin. "
- So will I be getting same-origin issues while trying to access the server even after deploying on to the mobile?
- Should I use JSONP for this? but again I cant send huge data in GET and POST doesn't work with JSONP!
- Host all my files on the server itself and call each page as and when required from the webview?
- Allow access from any origin in my server? For testing I can do this but for deployment on client location I don't think its a good idea!
- Any other approaches please?
Please help me as I am so new to this world!!