Spotify Web API - Search for an Artist (and Lookup) Demo

Searches for an artist, displaying their albums and making it possible to play a 30 second preview of the first track of each album.

HTML

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.1/handlebars.min.js"></script>
<link rel="stylesheet" href="https://developer.spotify.com/web-api/static/css/cached.css">

<h2>Albums on searching "Bowie"</h2>
<ul id="album"></ul>

JavaScript

searchAlbums("bowie");

	function fetchTracks (albumId, callback) {
	    $.ajax({
	        url: 'https://api.spotify.com/v1/albums/' + albumId,
	        success: function (response) {
	            callback(response);
	        }
	    });
	};

	function searchAlbums(query) {
	    $.ajax({
	        url: 'https://api.spotify.com/v1/search',
	        data: {
	            q: query,
	            type: 'album'
	        },
	        success: function (data) {
	            console.log(data);
				$.each(data.albums.items, function(k, v) {
					console.log("results-->", v);
					$("#album").append('<li><div>Name:: '+v.name+'</div></li>');
				});
	        }
	    });
	};