Loading web services in PhoneGap

  • 2
  • Question
  • Updated 8 years ago
I was wondering if PhoneGap apps have the same sort of cross domain restrictions that a website would have when accessing a web service. If I were to try loading a web service, would I need to change anything on the server to make it work properly? Or will I just be able to access it just fine. (If I makes a difference, I'm accessing the web service using Sencha Touch 2)
Photo of Michael Parrott

Michael Parrott

  • 8 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 2
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
PhoneGap blocks access to external domains unless those domains have been whitelisted, depending on the platform.

You should not need to change it on the server if that code already works fine by itself.

-yiming
Photo of Steve Gill

Steve Gill, Employee

  • 43 Posts
  • 1 Reply Like
It doesn't have the same cross-domain restrictions due to it using the file protocol.

Cheers,
-Steve
Photo of Michael Parrott

Michael Parrott

  • 8 Posts
  • 0 Reply Likes
Awesome, thanks!
Photo of Michael Parrott

Michael Parrott

  • 8 Posts
  • 0 Reply Likes
Could someone give me an example of how to use jQuery.ajax to access a web service, preferably with an example of a publicly available web service that works? I can't seem to get it working.
Is the access tag in config.xml (for PhoneGap Build) a requirement? I've tried with and without with no success.