我目前正在使用cloudapp API开发一个项目,我正在使用jquery.这是我的代码:
$.ajax({
headers: { "Accept": "application/json"},
type: 'GET',
url: 'http://cl.ly/2wr4',
crossDomain: true,
success: function(data, textStatus, request){
console.log(data);
}
});
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我得到200 OK响应并在Firefox中出现此错误:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://cl.ly/2wr4. This can be fixed by moving the resource to the same domain or enabling CORS.
Run Code Online (Sandbox Code Playgroud)
以及Google Chrome中的此错误:
XMLHttpRequest cannot load http://cl.ly/2wr4. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
并且没有任何内容记录到控制台.请问我该如何解决这个错误?
谢谢.
我想知道soundcloud如何生成他们的波形.
谢谢