Created
September 4, 2010 19:58
-
-
Save also/565446 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
<!-- make a synchronous cross-domain request to The Echo Nest API --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Echo Nest API Cross-Domain Example</title> | |
</head> | |
<body> | |
<h1>Echo Nest API Cross-Domain Example</h1> | |
<p><strong>Results:</strong></p> | |
<p><code id="results"></code></p> | |
<script type="text/javascript"> | |
var url = "http://london.developer.sandpit.us/api/v4/artist/images?api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F"; | |
var req = new XMLHttpRequest(); | |
req.open('GET', url, false); | |
try { | |
req.send(null); | |
} | |
catch (e) { | |
document.getElementById('results').innerHTML += e; | |
} | |
if(req.status == 200) { | |
document.getElementById('results').innerHTML += req.responseText; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment