我正在尝试使用Angular.js服务从Jersey/Spring的REST服务中获取JSON.
当我使用Firefox时,它工作正常,但当我去Chrome时,我收到了消息:
XMLHttpRequest cannot load http://localhost:8080/VirtualLawyerPj/services/timeoftheday/asjson/tue. Origin http://localhost:8090 is not allowed by Access-Control-Allow-Origin.
Run Code Online (Sandbox Code Playgroud)
这是我的服务代码:
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}
});
});
Run Code Online (Sandbox Code Playgroud)
有人有同样的问题吗?你是怎么做到这一点的?
谢谢.
| 归档时间: |
|
| 查看次数: |
20635 次 |
| 最近记录: |