I am successfully sending a getJson request to lastFM using the code below. This code is within a javaScript script. Can I get the result from the getJson function and use it outside of that function as a variable, i.e. in this within the calling javaScript?
function getArtistInfo(lastFmArtist) {
var urlArtist = 'http://ws.audioscrobbler.com/2.0/?callback=?',
params = {
method: "artist.getInfo",
artist: lastFmArtist,
format: "json",
api_key: "xxxxxxxxxx"
};
$.getJSON(urlArtist, params, function(data) {
var myartist = data.artist.bio.summary;
});
}
alert(myartist);