가져 오기 요청으로 API에 액세스하려고합니다. 일부 웹 사이트에서는 매력처럼 작동하지만 일부에서는이 오류가 발생합니다 , 나는API에 액세스 할 수 없습니다. 요청한 리소스에 'Access-Control-Allow-Origin'헤더가 없습니다.
Failed to load https://bittrex.com/api/v1.1/public/getticker?market=btc-usd:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://mydomaine.com' is therefore not allowed access. If an opaque
response serves your needs, set the request's mode to 'no-cors' to fetch the
resource with CORS disabled.
내가 잃었어요 ... 그것이 작동하는 브라우저에서 링크를로드하면, 나는 모든 것을 시도했다. 는 내가 대신이 글을 읽은
fetch(urlbittrexbtcusd,{ mode: "cors"})
.then(function(response) {
if(response.status == 200) { // Check if response went through
response.json().then(function(data) {
console.log(data);
bittrexbtcusdprice = parseFloat(data.result.last).toFixed(2);
});
} else { // Response wasn't ok. Check dev tools
console.log("response failed?");
console.log(response);
}
});
"고르"의 "노 고르"를 쓸 경우 똑같은 일을 얻을 수 있지만, 그것을 달성하기 위해 시도하는 방법과 연결하는 것을 알아낼 수 없습니다 내 코드로 가져 오기 ... https://www.html5rocks.com/en/tutorials/cors/ "메서드"는 무엇을 말하는지 이해하지 못합니다.
나는 내 서버가 아닌 FTP에 있습니다.
의 사용 가능한 복제 [왜 내 자바 스크립트를 얻을 않는 '없음'액세스 제어 - - 원산지 허용 '헤더가 요청 된 자원에 존재하는 "오류 때 우체부하지 않습니다?] (https : //로 유래 .com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-head-is-present) – marekful
새로운 것은 자신의 연구를하지 않기에 충분한 변명이 아닙니다. 질문하기 전에 문제의 밖에는 많은 자원이 있습니다. 질문 제목을 Google에 입력 해 보셨습니까? – marekful
중복 된 것으로 표시된 질문을 발견했습니다. 그러나 일부 웹 사이트에만 적용되며 다른 웹 사이트에는 변경되지 않습니다. – Ilan