且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery 循环遍历 AJAX 成功的 JSON 结果?

更新时间:2022-10-17 21:48:33

you can remove the outer loop and replace this with data.data:

$.each(data.data, function(k, v) {
    /// do stuff
});

You were close:

$.each(data, function() {
  $.each(this, function(k, v) {
    /// do stuff
  });
});

You have an array of objects/maps so the outer loop iterates over those. The inner loop iterates over the properties on each object element.