Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSONP Support #16

Open
abdoMous opened this issue Jan 15, 2015 · 3 comments
Open

Add JSONP Support #16

abdoMous opened this issue Jan 15, 2015 · 3 comments

Comments

@abdoMous
Copy link

thanks for this great library :)

i am working on mobile app under ionicframework.com

is there any possibility to configure JDrupal to work through Jsonp ?

@signalpoint
Copy link
Owner

@moussaoui91 you're welcome. I am not very familiar with JSONP, so I'm not quite sure what is involved. Will you please provide a simple example of JSONP? Say for example, which service resource(s) are you trying to work with first? Do you have the JSONP syntax that is necessary for them? Either way, I would like to add support for it, I just personally haven't needed it yet (nor have any of my clients).

@signalpoint signalpoint changed the title can JDrupal work through Jsonp? Add JSONP Support Jan 15, 2015
@abdoMous
Copy link
Author

As i said before, i was working on mobile app under ionicframework.com,

open source front-end SDK for developing hybrid mobile apps with HTML5.

so i need your library JDrupal to do the communication with my drupal service.

The mobile app SDK (mobile localhost i think) have to request data from Drupal server within defrent domain (www.drupalexamplesite.com)

so it cuz the error

XMLHttpRequest cannot load http://www.drupalexamplesite.com/site//?q=services/session/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.

this problem can solved by sending the request with JSONP technique.

JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a different domain

http://en.wikipedia.org/wiki/JSONP

fortunately, service drupal module support JSONP as an option at stile options.

@signalpoint
Copy link
Owner

@moussaoui91 That's good the Services module offers JSONP support. Until I (or a client) needs JSONP support, I won't be able to dedicate any resources to it. If you work well with JSONP, I would appreciate advice on how support can be added.

Until then, when working with localhost and a remote Drupal server, you can use Google Chrome and disable web security: http://www.drupalgap.org/node/223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants