问题
i have in my localhost:8111 a restlet app running. This app have a ServerResource that respond http requests from a javascript api that i'm doing.
This Javascript api is running in my apache in localhost, and i want to do http request to the localhost:8111, but i can't for the cross domain problem.
The restlet response in json, which solution is the best in this case?
Thanks!
回答1:
The same as any other case.
- CORS if you want control and are willing to sacrifice some cross-browser support.
- JSON-P if you can live with GET only requests and no security over which sites can trigger the request
- A proxy on the same origin if you don't need the final server to get credentials directly from the client
来源:https://stackoverflow.com/questions/8136107/best-method-to-get-over-cross-domain-in-javascript