jQuery Ajax 遮罩实例

function transferip()
{
    var site_list=$("textarea[name='Oldsite']").val();
    var ip_list=$("textarea[name='Oldip']").val();
    var ip_new=$("input[name='Newip']").val();
    if(ip_list==""||ip_new=="")
    {
        alert('IT CANNOT BE EMPTY!');
        return false;
    }
    ajaxStar("LOADING...");
    $.ajax(
    {
        type:"post",
        url:"transip.mazey",
        data:{"search":"check_ip","ip_list":escape(ip_list),"ip_new":ip_new,"site_list":escape(site_list)},
        error:function(){
            ajaxClose();
            alert("SYSTEM ERROR!");
        },
        success:function(msg)
        {
            ajaxClose();
            var msgArr=msg.split("-|-")
            if(msgArr[0]=="413")
            {
                alert(msgArr[1]);
            }
            else
            {
                alert(msgArr[1]);
            }

        }
    }
    )
}

/**div加载ajax效果***/
function ajaxStar(str,e){//str提示信息  e:iframe框访
    var html="";
    html+="<div id='ajaxLoadDiv'></div>";
    html+="<div class='ajaxLoadIcon'>";
    html+= "<span class='ajaxIcon'></span>";
    if(str)
        html+="<span class='ajaxInfo'>"+str+"</span>";
    html+="</div>";
    $("body").append(html);    
    var divH=$(document).height();//-$("#admin_topbj").height();
    $("#ajaxLoadDiv").css({"height":divH,"top":0,"opacity":0.5});
    var iconTop=$(window).height()/2;
    iconTop=iconTop+$(document).scrollTop();
    $(".ajaxLoadIcon").css({"top":iconTop+"px"});
}

/****关闭ajax遮罩*****/
function ajaxClose(){    
    $("#ajaxLoadDiv").remove();
    $(".ajaxLoadIcon").remove();    
}

function look_seven(){
    window.location.href="/Setinmanager/winhost/migratejob/record.asp";
}

图片:overlay.png

图片:ajaxLoad.gif

发表评论

您的电子邮箱地址不会被公开。