【发布时间】:2015-12-15 09:05:42
【问题描述】:
我在使用以下代码请求时收到 Cross-Origin Request Blocked: 错误。
$.ajax({
url: 'https://www.google.com/m8/feeds/contacts/default/full?access_token=' + token.access_token,
type: 'POST',
crossOrigin: true,
crossDomain: true,
Origin: 'http://localhost',
Host: 'www.google.com',
xhrFields: {
withCredentials: true
},
dataType: 'xml',
'Gdata-version': '3.0',
'Content-Type': 'application/atom+xml',
'body': xml,
}).done(function(data) {
console.log(data);
});
});
GET 方法以 jsonp(不适用于 POST 方法)作为数据类型检索联系人,没有任何错误,但在 POST 方法中出现错误。
【问题讨论】:
标签: javascript jquery xml google-api google-contacts-api