(开发笔记)layer.open弹出层的使用


function sameClassT() {
	var ids=$('#dataGrid').jqGrid('getGridParam','selarrrow');
	if (ids.length<1){
		js.alert("请选中文件")
	}else if (ids.length>1) {
		js.alert("请勿选择多个文件")
	}else {
		layer.open({
			title:'同分类调件',
			type: 2,
			area: ['80%','80%'],
			content: '${ctx}/collect/documentv/sameClassT?archtypeid=${archtypeid}&id='+ids[0],
			btn: ['保存排序','关闭'],
			btn1:function (index,layero) {
				console.log("保存排序");
				var win=$(layero).find("iframe")[0].contentWindow;
				jQuery.support.cors=true;
				$.ajax({
					type: "POST",
					dataType: "json",
					async: false,
					url: "${ctx}/collect/documentv/sameClassT2" ,
					data: {
						"archtypeid":"${archtypeid}",
						"ids[]":ids
					},
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					contentType: "application/x-www-form-urlencoded;charset=utf-8",
					success: function (data) {
						layer.alert(data.message);
					},
					error : function() {
						console.log("异常!");
					}
				});
			},
			btn2:function (index,layero) {
				console.log("关闭");
				var win=$(layero).find("iframe")[0].contentWindow;
				layer.close(index);
			}
		});
	}

}

 

你可能感兴趣的:(前端,自用)