如何在JQ函数中编辑js变量?

时间:2019-02-01 15:10:08

标签: javascript jquery

for loop中的console.log在工作,但在外面的undefinded

var counter;

$.get( "https://api.123.json", function( data123 ) {
  console.log("Ilość danych: " + data123.feeds.length);
  console.log(data123.feeds[15].field4);

  for (var i = 0; i < data123.feeds.length; i++) {
    counter = data123.feeds[i].field4;
    console.log(counter);
  }
});

console.log("Poza jquery: " + counter);

0 个答案:

没有答案