【发布时间】:2016-01-20 00:32:36
【问题描述】:
我正在尝试这段代码:
$.ajax(
{
xhrFields: {
withCredentials: true
},
url: 'http://localhost:5984/tdrepo/_design/tdr/_view/repopoolverified?group_level=1',
type: "GET",
success: function(result) {
var $tr = $('<tr/>');
$tr.append($('<td>').html(result.itemname));
$tr.append($('<td>').html(result.Repository));
$tr.append($('<td>').html(result.AIPcount));
$('.list-order tr:last').before($tr);
但我收到此错误:
凭据标志为“true”,但“Access-Control-Allow-Credentials”标头为“”。必须为“真”才能允许凭据。因此,Origin 'null' 不允许访问。 我启用了 CORS: enable_cors = true
和 [cors] origins = * 但它仍然无法正常工作
【问题讨论】:
-
服务器必须在 OPTIONS 预检请求上设置该标头,否则将无法发出完整请求