layer 经常用的一些方法
//删除确认
function m_del(id) { layer.confirm('确认删除?',{ btn:['确认','取消'], },function(index,layero){ $.ajax({ type: "POST", url: durl, data: { 'id': id }, success: function (data) { if (data.Success) { layer.alert('成功', { icon: 1 }, function () { location.reload(); }) } else { var mess = ''; mess = "你好,<a style='color:red' target='_blank' href=''>" + data.Message + "</a>"; layer.alert(mess, { icon: 2 }); } } }); },null) }
2.加载
$('.m_save').click(function () { var index = layer.load(1, { shade: [0.5, '#fff'] }); $.ajax({ type: "POST", url: "", data: { 'm': 123 }, success: function (data) { layer.close(index); if (data.operationDone) { window.parent.location.reload(); } else { layer.alert(data.Message, { icon: 2 }); } } }); });