its my code for editing image src with output from json request everything works before return but when i'm write code to return output its getting error, dont changing image src.
$(function(){
$( ".plimg" ).attr(
"src",
function( index ){
track = '212';
artist = 'azealea banks';
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=track.search",
{
track: track,
artist: artist,
api_key: "ca86a16ce762065a423e20381ccfcdf0",
format: "json",
lang: "en",
limit: 1 },
function(data) {
var output = data.results.trackmatches.track.image[0]["#text"];
});
return output;
}
);
});