“Access-Control-Allow-Origin”标头包含多个值“http://localhost:8080,http://localhost:8080,http://localhost:8080”,但只允许一个。因此,不允许原点“http://localhost:8080”访问。
我的代码是:
$.ajax({
url: "http://tilesdev1.intra.schneider.com/api/fa-snihelp-service/entserv",
type: "GET",
dataType: 'json',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
success: function (result) {
debugger;
},
error: function (xhr, textStatus, error) {
console.error(error);
},
});