I've been struggling with this for way too long tonight, and I haven't found anything useful when searching for answers. It's probably very simple.
I'm trying to load data using the Spotify Metadata API by doing AJAX calls with jQuery. Running this request in a browser works just fine: http://ws.spotify.com/search/1/track?q=foo But when I try to load the same request using jQuery I get nothing in response. I've tried different contentTypes and dataTypes, but I can't figure out what's wrong!
The code is quite simple:
$.ajax({
url: "http://ws.spotify.com/search/1/track",
data: "q=foo",
success: function(xml){
// do stuff...
},
contentType: "application/xml",
dataType: "xml"
});
If I save the XML returned when running the query in the browser, and loading that file as the url-parameter in the $.ajax-request, everything works just fine, so I guess it has something to do with the format.
The documentation for the Spotify Metadata API might be useful, but I can't figure out what I could be doing wrong.