Created
May 28, 2013 20:44
-
-
Save brycedorn/5665969 to your computer and use it in GitHub Desktop.
The actual function as described in the tutorial on mah blog.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function top_artists(){ | |
if (window.XMLHttpRequest) | |
{// code for IE7+, Firefox, Chrome, Opera, Safari | |
xmlhttp=new XMLHttpRequest(); | |
} | |
else | |
{// code for IE6, IE5 | |
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
xmlhttp.open("GET","http://ws.audioscrobbler.com/2.0/user/BDORN/weeklyartistchart.xml",false); | |
xmlhttp.send(); | |
xmlDoc=xmlhttp.responseXML; | |
var x=xmlDoc.getElementsByTagName("artist"); | |
for (i=0;i<8;i++) | |
{ | |
document.write("<li>"); | |
document.write("<a href='"); | |
document.write(x[i].getElementsByTagName("url")[0].childNodes[0].nodeValue); | |
document.write("'>"); | |
document.write(x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue); | |
document.write(" ("); | |
document.write(x[i].getElementsByTagName("playcount")[0].childNodes[0].nodeValue); | |
document.write(")"); | |
document.write("</a>"); | |
document.write("</li>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment