1
votes

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(''));
    });
  }

2
seems like a blank space issue, have you tried substituting it for %20?hagensoft
Yes I have. It seems to be working correctly today. Perhaps it was just an issue with server load or something. Thanks.Stephen M. P.

2 Answers

1
votes

try using 'foo%20fighters' as the term parameter.

0
votes

The issue is resolved as it seems to be working correctly today. Perhaps it was just an issue with server load or something.