1

From a function, I'd like to return a collection of soundcloud sounds using the SoundCloud javascript SDK. However, because soundcloud is using asynchronous requests, the is not possible:

function getFavorites() {
    var tracks = [];
    SC.get('/users/1234', function(data) {
      $.each(data, function (i, obj) {
        tracks.push(obj);
      });
      return tracks;
    });
}

How can I return a value from an asychronous request?

4

1 回答 1

0

SoundCloud JavaScript SDK 不支持同步请求。相反,您必须在回调中处理结果。

于 2013-02-10T09:02:30.357 回答