I have a Java service running on my main OS (Windows7 Pro.) And I can access it in a browser http://localhost:8080/.... It returns a valid JSON reposition.
I also have a SPA written in angularjs, which is located on my virtual machine, where I created Virtual-Host for it (for easier access). The virtual machine OS is Ubuntu Server 12.04.X LTS.
Since these environments are separated from each other in network terms, I tried to access the Java service through my IP address of the local machine X.X.X.X:8080(ping through the terminal did send a response). Since normal use $httpdoes not work, I tried to find the solution suggested in this answer How to load cross-domain JSON using $ http in angularjs 1.0.8, as it happens with 1.2.0 , but either it is too old or something else so, but when I try to do the same, it just doesn't work. In the console, I see only the following
XMLHttpRequest cannot load http://X.X.X.X:8080/library/api/books. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dev.xxx' is therefore not allowed access.
source
share