返回的数据是数组,每条里还有子对象 也是数组,例如图:
$.ajax({ url:urlT + "/rest/video/queryAllCourses" , type:"get", data:'', async:false, success:function(data) { //console.log(data); $.each(data.data, function (i, result) { var item = "<li class='listHeader'><a class='listTitle' groupid="+result.id+">"+result.title+"</a><ul class='listContent'>"; $.each(result.contentList, function (key, content) { item +="<li ><input type='checkbox' itemid="+content.id+" >"+content.title+"</li>"; }) item +=" </ul></li>"; $('.list').append(item); }); }, error:function(){ alert("获取数据失败!") }