1
I need to run a jQuery Get()
inside another, but I’m not getting anywhere, just ignore the second Get()
without returning what I need (the username of the second get()
):
$.getJSON("https://api.mercadolibre.com/users/" + minha_id + "/order_blacklist?access_token=" + access_token, function(data){
var employee_data ='';
for (var i = 0; i < data.length; i++) {
employee_data += '<tr>';
$.getJSON("https://api.mercadolibre.com/users/" + data[i].user.id + "?access_token=" + access_token, function(valor){
username = valor.nickname;
employee_data += "<td>" + username + "</td>";
});
employee_data += '<td>' + data[i].user.id + '</td>';
employee_data += '<td>' + data[i].user.blocked + '</td>';
employee_data += '</tr>';
$('#employeed_table').append(employee_data);
}
});
There is a serious problem with your code. You are placing an asynchronous request within a code
for
, This is dangerous, it may never work your code this way.– bio