url: ctx + "", type: 'get', dataType: 'json', success: function(data) { //data 为后台返回的json数据 var names = []; //定义两个数组 var nums = []; $.each(data, function(key, values) { //此处我返回的是list<String,map<String,String>>循环map names.push(values.parent_name); var obj = new Object(); obj.name = values.parent_name; obj.value = values.principal; nums.push(obj); }); });
这样明白不?
url: ctx + "", type: 'get', dataType: 'json', success: function(data) { //data 为后台返回的json数据 var names = []; //定义两个数组 var nums = []; $.each(data, function(key, values) { //此处我返回的是list<String,map<String,String>>循环map names.push(values.parent_name); var obj = new Object(); obj.name = values.parent_name; obj.value = values.principal; nums.push(obj); }); });