在layui弹出层填充遍历的数据;

时间:2025-01-20 07:49:46

从url = "/corpore/checkdata"中拿到数据,定义一个数组,for循环遍历list,添加到arr数组中,定义一个layui弹出层,填充arr数组;为了防止重复执行checkdatas();事件导致打开多个layui弹出层,在代码最后加上();关闭前一个弹出层。

<script type="text/javascript">

					function checkdatas() {
						var id = $("#corporeId").html();
						var url = "/corpore/checkdata";
						$.post(url, {
							id : id
						}, function(data) {
							if (true == ) {
								$("#check1").removeAttr("style")
								$("#check2").removeAttr("style")
								='/page/workbench/notice';
							} else {
								var list = ;
								var arr=[];
								for ( var k in list) {
									arr+='<p>'+list[k]+'</p>';
								}
								var index = ({
									type:1,
									title:'提示信息',
									area:["300px","240px"],
									offset:'rb',
									shade: false,
								    maxmin: true,
									shadeClose:true,
									time:60000,
									content:arr
								}) ; 
								//(index-1);
							}
							(index-1);
						});
						
					}
				</script>