When I try to loop, I do not even want to get into the for, I already checked and the array with the object is not empty, but it does not execute the loop ... Any ideas?
var caminho = [];
$.get("http://localhost/crocs/arquivo.json", function(data) {
data = typeof data == 'string' ? JSON.parse(data) : data;
data.forEach(function(elementoDaArray) {
skuid = elementoDaArray.SkuId;
valor = elementoDaArray.Valor;
letra = elementoDaArray.Letra;
imagem = elementoDaArray.Imagem;
caminho.push({
img: imagem,
id: skuid
})
});
});
for (var i = 0; i < caminho.length; i++) {
console.log(products[i].img);
}