我正在访问 soundcloud api 以获取 stream_url。我已将此代码上传到 2 个不同的地方:
1) 下载不工作 + ajax 调用失败并出现以下错误:
- XMLHttpRequest 无法加载https://soundcloud.com/woodymusic/woody-heideglu-hen-2-20-04。无法从 null 发出任何请求。indextest.html:1
- 错误:错误
网址:http: //download.berlintechno.net/test/indextest.html
2)下载+一切正常
网址:http ://dl.dropboxusercontent.com/u/26890303/indextest.html
以下代码
<html>
<head>
<title>
</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body >
<div id="results"><a href="https://api.soundcloud.com/tracks/99777114/stream?client_id=fb14c3f2a35b89b556cce18b8614e908" class="btn btn-large scdown">1</a><br>
<a href="https://api.soundcloud.com/tracks/18658191/stream?client_id=fb14c3f2a35b89b556cce18b8614e908" class="btn btn-large scdown" download="Woody @ Licht&Liebe Open Air, Berlin 29-05-2011.mp3">2</a><br>
<a href="https://api.soundcloud.com/tracks/11144882/stream?client_id=fb14c3f2a35b89b556cce18b8614e908" class="btn btn-large scdown" download="Woody + Lodig, Weissgerberlaende Afterparty, 1994 - Vienna.mp3">3 </a><br></div>
<script>
$.ajax({
type: "GET",
url: "https://api.soundcloud.com/tracks/99777114/stream?client_id=fb14c3f2a35b89b556cce18b8614e908",
//beforeSend: function(xhr){xhr.setRequestHeader('Origin', null);},
success: function(data) {
console.log(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('error: ' +textStatus);
}
});
</script>
</body></html>
主机 download.berlintechno.net 是否受到来自 soundcloud api 的任何限制的影响?