I've created this function, however when it runs on the website it's designed for it is returning undefined. I did some quick Googling and found that because it's an asynchronous function, it completes and returns the data before the server can respond. I'm stumped however on how to convert it to a synchronous function.
Here is my code:
render_SC = function() {
var SC_url;
$.get(Dubtrack.room.player.activeSong.url, function(f) {
SC_url = f.data.songInfo.images.thumbnail.replace('large','original');
});
return SC_url;
};
console.log(render_SC());
Thanks in advance for all your responses. :)