java后台查出的数据在前台没有显示,前台使用的bootstrap?
章节 --请选择--${chapter.title}

2个回答

输出到控制台看下data结构啊

qq_40689507
qq_40689507 回复Dawn1124: $.each(data.chapters, function(index,obj) { var id=obj.id; var title=obj.title; $("#select0").append('<option value='+id+'>'+title+'</option>'); console.log(title); });写了循环还是显示不出来
一年多之前 回复
Dawn1124
Dawn1124 回复qq_40689507: 你传过来的chapters对应多个对象 你前台要循环的呀
一年多之前 回复
qq_40689507
qq_40689507 回复: 是这样子的
一年多之前 回复
qq_40689507
qq_40689507 {"msg":"success","teacher":null,"subject":null,"question":null,"chapter":null,"subjects":null,"questions":null,"chapters":[{"id":"1","title":"第一章、春秋战国时期","subject":{"id":"2","sno":"1002","subjectname":"历史","teacher":{"id":"1","tno":"20154401","teachername":"李","school":"重庆工商职业学院","pwd":"111"}}},{"id":"2","title":"第二章、古代器具","subject":{"id":"2","sno":"1002","subjectname":"历史","teacher":{"id":"1","tno":"20154401","teachername":"李","school":"重庆工商职业学院","pwd":"111"}}},{"id":"4","title":"第三章、古代考试制度","subject":{"id":"2","sno":"1002","subjectname":"历史","teacher":{"id":"1","tno":"20154401","teachername":"李","school":"重庆工商职业学院","pwd":"111"}}}]}
一年多之前 回复

可以试试后台以json数据提交的方式,前端应Ajax进行处理显示

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问