【发布时间】:2014-09-18 11:39:56
【问题描述】:
这是他们API documentation的链接
我想通过从头开始创建比特币价格代码来练习 Web 编程。我的计划是提供一个脚本,让 api 调用交易所来显示数据。这意味着我只需要提供脚本,而不是处理数据服务器端。
我知道编程的一部分是从文档中学习,但是来自 bitfinex 的文档非常稀少,我找不到教程。
我创建了一个 index.html 来测试我的 javascript。它返回一个控制台错误:
XMLHttpRequest cannot load https://api.bitfinex.com/v1/pubticker/:last_price.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.
这里是完整的 index.html:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
</head>
<body>
<script>
$.getJSON("https://api.bitfinex.com/v1/pubticker/:last_price",
function(data, status){
alert("price: "+data +" status: " + status);
}
)
</script>
Thank you stack exchange
</body>
【问题讨论】:
-
您的问题似乎是实现而不是设计(“我如何调试这个”)。因此,它不太适合 P.SE(有关 P.SE 范围内的问题的更多信息,请参阅help center)。
标签: javascript asp.net-web-api