您有一个JSON字符串,而不是一个对象。告诉jQuery您期望JSON响应,它将为您解析它。使用$
.getJSON代替$
.get,或将dataType参数传递给
$.get:
$.get( 'index.php?r=admin/post/ajax', {"parentCatId":parentCatId}, function(data){ $.each(data, function(key, value){ console.log(key + ":" + value) }) }, 'json');


