I have the following code:
function get() {
var item = '<li class="is-loading">';
$.getJSON(urlJson, function(data){
$.each(data, function(k,v){
item = v['title']; // What I need to return
console.log(url); // See? Here there is the content
});
});
console.log('Item: ' + item); // See? Nothing else here is being returned like before
return item;
}
And the problem is: the return is empty. Inside of each
it looks like the value is not goint to title
. Any suggestion?