【发布时间】:2018-03-02 09:35:22
【问题描述】:
我已经尝试了所有的东西,使用CORS 插件。禁用 chrome 中的网络安全。
响应来自POSTMAN,但无法在$http 中获取。
$http({
url: "https://interview-api-staging.bytemark.co/books",
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET,OPTIONS,PUT,DELETE',
'Access-Control-Allow-Headers': 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since'
}
}).then(function(d) {
console.log(d);
});
【问题讨论】:
-
“无法获取”是什么意思?您收到错误响应吗?控制台中是否打印任何内容?
标签: angularjs ajax http cors postman