以下是我的代码:JSON API GET请求错误
$(document).ready(function(){
$.ajax({
url: 'https://bitconnect.co/api/info/BTC_BCC',
type: 'get',
dataType: 'json',
success: function(data){
alert(data);
},
error: function(error){
alert(error);
}
});
});
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src = "//code.jquery.com/jquery-1.12.4.js"></script>
<script src="try.js"></script>
</head>
<body>
</body>
</html>
我想从AJAX的URL部分中提到的URL上的信息。 但我发现了以下错误:
Failed to load https://bitconnect.co/api/info/BTC_BCC: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
我完全新的这个部分,没有的错误是什么想法。 如果我能得到任何帮助,这将是一件好事。 在此先感谢。
的[为什么我的JavaScript得到一个“不‘访问控制允许来源’标头出现在所请求的资源”错误,当邮差没有可能的复制?(https://开头stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present) – Isma
是的,但我仍然没有得到那里给出的。 –
你可以尝试使用代理url给我的解决方案,我已经测试过它,它的工作 –