Jquery 自定义弹窗等待

时间:2021-01-17 02:07:12
(function ($) {
$.extend({
//弹窗蒙层
ShowLoadDialog : function () {
if ($("#divtip*").length <= ) {
var cusrtxt = $("<div id=\"divtip*\" style=\"position:absolute; z-index:6666;background-color:#000000; opacity:0.6; top:0; bottom:0; right:0; left:0;\"></div>").appendTo($("body"));
var atexthtml = "<div style=\"margin-top:25%;text-align:center;\"> <img src=\"/Content/themes/tip/xuloading.gif\" /></div>";
$("#divtip*").html(atexthtml);
}
else {
$("#divtip*").css("display", "block");
} }, //关闭蒙层
ShowLoadDialogClose: function ()
{
if ($("#divtip*").length > ) { $("#divtip*").css("display", "none"); }
}
});
}
)(jQuery)

Ajax Demo:

//省级区域选择
$ParentAreaChange = function (currobject) {
var currvals = $(currobject).val();
$.ajax({
type: "POST",
url: "/AdminMgr/SysArea/GetAreaByCode",
data: { parenccode: currvals, defalutdata: "选择市" },
datatype: "json",
beforeSend: function () {
$.ShowLoadDialog();
},
success: function (data) {
$.ShowLoadDialogClose();
$("#sidvlect").html('');
$("#xianvlect").html('');
if (data.length > ) {
var htmlselect = "";
for (var index in data)
htmlselect += "<option value='" + data[index].c_AreaCode + "'>" + data[index].c_AreaName + "</option>";
htmlselect = "<select id=\"SiQuCode\" name=\"SiQuCode\" onchange='$SiQuyeAreaChange(this)'> " + htmlselect + " </select>";
$("#sidvlect").html(htmlselect);
$("#AreaCode").val("-1");
}
else {
$RecordAreaText();
$("#AreaCode").val(currvals);
}
console.log($("#AreaCode").val());
},
complete: function (XMLHttpRequest, textStatus) { },
error: function () { }
});
}