1

very new at this. Could someone tell me what is the best method of submitting a form when using phonegap and JMQ? What I want to be able to do is passing the form data to a php file and then having the results passed back into app so that the user isnt directly accessing the php file at any point.

I found the following page link which basically does what I want but I keep getting "Origin null is not allowed by Access-Control-Allow-Origin" when testing out the code. So I'm guessing this will only work if the app is located on a server also?

Any happy would be great. thank <3

Community
  • 1
  • 1

2 Answers2

1

To test your solution on the computer you need to launch chrome from the terminal with the argument --disable-web-security. See this answer: Disable same origin policy in Chrome

In your Phonegap application you add a line of code to your config.xml in the www-folder: <access origin="*.yourdomain.com" />. Build, and you are now allowed to request all domains and subdomains from yourdomain.com. For more details on whitelisting see http://docs.phonegap.com/en/3.0.0/guide_appdev_whitelist_index.md.html#Domain%20Whitelist%20Guide

Community
  • 1
  • 1
TJ-
  • 116
  • 10
1

You are not able to make post through the local files, so Yes, you need to have it running in a Web Server.

But if you deploy your application, it should work either in a emulator or in your device.

Saxophonist
  • 617
  • 7
  • 15