最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jquery ajax加载数据前台渲染方式 不用for遍历的方法
时间:2022-06-25 15:49:59 编辑:袖梨 来源:一聚教程网
如下所示:
var provinces = res.res;
var html = [];
var option_select='';
var tpl = '';
html.push(option_select);
$.each(provinces, function (i, n) {
html.push(tpl.format(n.name, n.id));
});
//alert(html.join());
$('#class').html(html.join(''));
function getXueke() {
var gradeId = $('#grade_id').val();
if (gradeId == '') {
$('#textbook_id').html('');
return;
}
$.get('index.php?m=Home&c=ClassList&a=getgradesandCourse', {
'grade_id': gradeId
}, function (res) {
var options = [];
$.each(res, function (index, item) {
options.push(''.format(item.id, item.course_name));
});
if (options.length > 0) {
$('#textbook_id').html(options.join(''));
} else {
$('#textbook_id').html('');
}
})
}
相关文章
- 暗喻幻想军港卡拉德里乌斯潜入攻略 11-01
- 暗喻幻想:ReFantazio无限刷钱方法 11-01
- 三国志8重制版同志身份作用介绍说明 11-01
- 三国志8重制版演义传和事件作用说明 11-01
- 三国志8重制版演义传特点介绍说明 11-01
- 三国志8重制版武将名声提升方法分享 11-01