【发布时间】:2015-08-22 05:12:07
【问题描述】:
我正在尝试在拨打电话之前设置标头,但它不起作用。
model: function() {
debugger;
Ember.$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader(
'Authorization', 'bearer 123456'
)
}});
return Ember.$.getJSON('http://addresss/api/locations').then(function(e) {
debugger;
console.log(e);
});
}
这不断给我以下错误消息:
请求中没有“Access-Control-Allow-Origin”标头 资源。因此不允许使用原点“http://localhost:4200” 访问。
如果我使用 Postman 并设置我的标题,它可以正常工作。
【问题讨论】:
标签: jquery ajax ember.js getjson