【发布时间】:2012-08-05 23:30:11
【问题描述】:
我不想通过从 Grooveshark 获取歌曲的 tinysong API 获取歌曲列表,我正在通过 $.ajax 获取歌曲列表,到目前为止我得到了这个:
$.ajax({
url : 'http://tinysong.com/s/Beethoven?format=json&key='+key,
type : 'get',
dataType : 'jsonp',
succes : function(response){
console.log(response);
$('.content').append(response);
},
error: function(error){
console.warn('ERROR');
console.warn(error);
}
});
key 是他们分配给我的 API 密钥。我收到以下错误:
资源解释为脚本,但使用 MIME 类型 text/html 传输:“http://tinysong.com/s/Beethoven?format=json&key=HERE_IS_MY_KEY&callback=jQuery172021696692402474582_1344209008518&_=1344209008523”。
但是,如果我访问该网址,我会得到如下打印结果:
[{"Url":"http://tinysong.com/Aoxo","SongID":25802452,"SongName":"A 大调第七交响曲 Op. 92: Allegretto","ArtistID" :1833,"ArtistName":"Beethoven","AlbumID":4497124,"AlbumName":"Beethoven: 9 Symphonien, Ouvert\u00fcren (1 of 6), Berstein, Leonard"},{"Url":"http: //tinysong.com/jh4X","SongID":2909282,"SongName":"降E大调第五钢琴协奏曲 op. 73 'Emperor'","ArtistID":1833,"ArtistName":"Beethoven" ,"AlbumID":268605,"AlbumName":"贝多芬之最"},{"Url":"http://tinysong.com/JhLy","SongID":31825464,"SongName":"贝多芬:钢琴F小调第23奏鸣曲,作品57,\"热情\"","ArtistID":1833,"ArtistName":"Beethoven","AlbumID":4913792,"AlbumName":"Beethoven's Greatest Hits"},{ "Url":"http://tinysong.com/6Jk1","SongID":4925300,"SongName":"Beethoven #4: Adagio","ArtistID":1833,"ArtistName":"Beethoven","AlbumID ":842118,"AlbumName":"Beethoven: Symphonies Nos. 7 & 4"},{"Url":"http://tinysong.com/gGW0","SongID":11896153,"SongName":"F\ u00fcr Elise","ArtistID":1833,"ArtistName" :"Beethoven","AlbumID":2087629,"AlbumName":"Beethoven and the Sea"}]
如何将这些信息传递给我的 javascript?
【问题讨论】:
标签: javascript jquery json grooveshark