实例:$.ajax({
type: "post",
data: $("form[name=myform]").serialize(),
dataType: "json",
url: URL,
beforeSend: function () {
$(this).attr("disabled","disabled");
layer.msg('处理中...', {icon: 16,shade: 0.01});
},
success: function (data) {
if(data.code == 200){
layer.msg('操作成功', {icon: 1,time:2000},function(){ //延时跳转并提示
layer.close(layer.index); //关闭窗口
window.parent.location.reload(); //刷新父级窗口
});
}else{
layer.msg(data.msg, {icon: 2});
}
},
complete: function () {
$(this).removeAttr("disabled");
},
error: function (data) {
console.info("error: " + data.responseText);
}
});