현재 내 사이트 www.midnightlisteners.com에 Last.fm API가 통합되어 있지만 마지막 Last.fm 데이터는 마지막 하나 인 Kanye West에 저장됩니다. (i) 아이콘 위로 마우스를 가져 가면 데이터가 툴팁에 표시됩니다.Last.fm API jQuery
나는 모두 반복하여 해당 위치에 추가하고 싶습니다. 누군가가 저에게 작은 아티스트 이미지를 줄 수 있다면 너무 좋을 것입니다.
내 jQuery 코드 :
내 HTML은 내 웹 사이트에 최선을 볼 수$(document).ready(function() {
// Find Related Artists based on Last.fm JSON Results
$(".artist-data").each(function() {
// Find the artist name in the "p" tag and save it
artistName = $(this).find(".artist-wrap-mid p");
artist = artistName.text();
// Create a class out of the artist name made of lowercase letters and "-" instead of spaces
artistClass = artist.toLowerCase().replace(/ /g, '-');
// Add this class to the .artist-data div
$(this).addClass(artistClass);
// Check if a value is present
if (artist === '') {
$("." + artistClass + " .related").html("No related artist info found for " + artist);
}
// Otherwise return the request with links to each related artist
else {
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=" + artist + "&api_key=9c991c10bf461ac4e4f92fdfa14c20c2&limit=3&format=json&callback=?", function(data) {
var html = '';
$.each(data.similarartists.artist, function(i, item) {
html += "<a href='http://" + item.url + "' target='_blank'>" + item.name + "</a>, ";
}); // End each
$("." + artistClass + " .related").append(html);
}); // End getJSON
} // End Else
});
});
그러나 내가 입수했습니다
<div class="related"> </div>
에 Last.fm에서 모든 데이터를 두는 도움의 톤 : writing.sackettsolutions.com/2012/02/navigating-the-last-fm-api-with-a-little-help-from-jquery-getjson
감사의 라인에 뭔가해야합니다, 당신은 어쩌면이 좀 도와 주 시겠어요? 나는 jQuery가 처음이다. 방금 jQuery 초보자가 ninja book을 읽기 시작했습니다. D – Pullapooh
위의 EDIT를 참조하십시오 ... – devnull69
어떻게하면이 코드를 구현해야합니까? – Pullapooh