I am trying to get the spotify web api to search for artist based on information provided in an html input field. My results, however, are not consistent. For example, if I search for "foo", I get decent results. However, if I search for "foo fighters", I don't get any results -- even though "foo fighters" will show up if I search for "foo" alone. Likewise, I can get results for "the" but not "katy perry", etc. I am running the code completely within javascript and am using the Jquery getJSON function to query Spotify.
function searchSpotify(term)
{
var reslt = $.getJSON("http://ws.spotify.com/search/1/artist.json?q="+encode_utf8(term), function(data) {
items = [];
$.each(data["artists"], function(key, val) {
items.push('' + val["name"] + '(listen on Spotify)');
});
$('#data').html(items.join(''));
});
}