Created
February 27, 2015 19:07
-
-
Save jkishner/a0b01f22253c477b7211 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>spotify for status board</title> | |
</head> | |
<body onload="spotifyAlbum()"> | |
<script> | |
function spotifyAlbum() { | |
var xmlhttp = new XMLHttpRequest(); | |
var url = "https://api.spotify.com/v1/albums/?ids="; // PUT ALBUM IDS, COMMA-DELIMITED, AFTER THE EQUALS SIGN AND BEFORE THE CLOSING QUOTE | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
var myArray = JSON.parse(xmlhttp.responseText); | |
count = myArray.albums.length; | |
var output = ""; | |
for (i=0;i<count;i++) { | |
output+= "<a href=launch://?url=" + myArray.albums[i].uri + "><img src=" + myArray.albums[i].images[1].url + " width=235 height=235></a><br>"; | |
} // end loop | |
document.getElementById("results").innerHTML=output; | |
} // end readystate or status | |
} // end onreadystatechange | |
xmlhttp.open("GET", url, true); | |
xmlhttp.send(); | |
} | |
</script> | |
<p id="results"></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment