我无法在 Angular 1.2.13 中创建成功的 get 请求。
var getProgress = function() {
var promise = $http({method: 'GET', url: 'http://localhost:8080/project/local/some/getStatus'});
promise.then(function(success) {
alert(JSON.stringify(success));
}, function(error) {
alert(JSON.stringify(error));
}, function(notify) {
alert(JSON.stringify(notify));
});
};
因此,我尝试从 REST Web 服务接收一些 JSON。为了测试该服务,我从浏览器(IE9、Firefox 27、Chrome 33)访问它,在所有浏览器中都运行良好。
然而,上面使用 Angular 的代码总是提示我错误:
*{“数据”:“”,“状态”:404,“配置”:{“transformRequest”:[null],“transformResponse”:[null],“方法”:“GET”,“url”:"http://localhost:8080/project/local/some/getStatus"
,"headers":{"接受":"application/json, text/plain,/"}}}*
Using 线鲨我检查 HTTP 请求和 HTTP 响应,两者都调用 Web 服务从浏览器和角度返回 200,以及所需的 json 对象!!尽管如此,Angular 还是提示我 404。
当我使用 Angular 从 Firefox 发出获取请求并使用 Findbugs 进行调试时,在控制台中我得到 HTTP 代码 200,但 Angular 却显示 404。尝试调试 Angular 的代码无济于事,看不到任何奇怪的东西。
上面的代码在IE9下可以正常运行!
任何建议表示赞赏。