var省份=res.res; var html=[]; var option_select=' & lt;选项值="祝辞请选择& lt;/option>”; var tpl=' & lt;选项值=" https://www.yisu.com/zixun/{1}”数据id=皗1}”数据名=皗0}”在{0}& lt;/option>”; html.push (option_select); 美元。每个(省、函数(我,n) { & lt;跨度比;& lt;/span> html.push (tpl.format (n.name n.id)); });//警报(html.join ()); $(" #类的). html (html.join (")); >之前函数getXueke () { var gradeId=$ (' # grade_id ') .val (); 如果(gradeId==") { $ (' # textbook_id ') . html (' & lt;选项值="祝辞,选择& lt;/option>”); 返回; } $ . get (" index . php # 63; m=Home& c=ClassList&一个=getgradesandCourse ', { “grade_id”: gradeId },函数(res) { var选项=[]; 美元。每个(res,函数(指数项){ options.push (' & lt;选项值=" https://www.yisu.com/zixun/{0}”在{1}& lt;/option>“.format (item.id item.course_name)); }); 如果选项。长度比;0){ $ (' # textbook_id ') . html (options.join (")); 其他}{ $ (' # textbook_id ') . html (' & lt;选项值="祝辞,请选择& lt;/option>”); } }) } >之前以上这篇jquery ajax加载数据前台渲染方式不用为遍历的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
jquery ajax加载数据前台渲染方式不用为遍历的方法