0

我正在访问 soundcloud api 以获取 stream_url。我已将此代码上传到 2 个不同的地方:

1) 下载不工作 + ajax 调用失败并出现以下错误:

网址: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&amp;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 的任何限制的影响?

4

1 回答 1

0

download.berlintechno.net 引用了这个 jQuery 库

<script src="http://code.jquery.com/jquery-2.0.3.js"></script>

而 dl.dropboxusercontent.com 引用了这个 jQuery 库

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

导致不同的行为。

于 2013-07-12T16:17:37.947 回答