记录使用ajax中获取一个list数据之后怎么解析
示例代码如下:
for循环
$.ajax({ type: 'GET', url: url, dataType: 'json', success: function (data) { for (i = 0; i < data.length; i++) { //业务代码 $('#ot_' + data[i].BsOrgTypeCD).prop("checked", true); } }, error: function (data) { top.layer.msg("获取机构类型失败!"); } });
each循环
$.ajax({ type: 'GET', url: url, dataType: 'json', success: function (data) { $.each(data, function (i, d) { //业务代码 $('#ot_' + d.BsOrgTypeCD).prop("checked", true); }); }, error: function (data) { top.layer.msg("获取机构类型失败!"); } });
编辑:孙小北
本文地址: https://www.xiaowangyun.com/wyblog/detail/?id=1060
版权归属: www.xiaowangyun.com 转载时请以链接形式注明出处
0 条评论