I'm trying to use an Angular.js service to get a JSON from my REST service made with Jersey/Spring.
When i'm using firefox, it works fine, but when i go to Chrome i got the message:
XMLHttpRequest cannot load http://localhost:8080/VirtualLawyerPj/services/timeoftheday/asjson/tue. Origin http://localhost:8090 is not allowed by Access-Control-Allow-Origin.
Here's my service code:
angular.module('myAppServices', ['ngResource']).
factory('Time', function($resource){
return $resource('http://localhost:port/VirtualLawyerPj/services/timeoftheday/asjson/tue',{port:":8080"}, {
query: {method:'GET', params:{}, isArray:false}
});
});
Someone had the same problem? How did you got this working?
Thanks.
The CORS solution is described at html5rocks tutorial. Worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With