首页 > 代码库 > AJAX遮罩实例

AJAX遮罩实例

function checksite()
{
    var site_list=$("textarea[name=‘Oldsite‘]").val();
    if(site_list=="")
    {
        alert(‘IT CANNOT BE EMPTY!‘);
        return false;
    }
    ajaxStar("SEARCHING...");
    $.ajax(
    {
        type:"post",
        url:"transip.asp",
        data:{"search":"check_site","site_list":escape(site_list)},
        error:function(){
            ajaxClose();
            alert("SYSTEM ERROR!");
        },
        success:function(msg)
        {
            ajaxClose();
            var msgArr=msg.split("-|-")
            if(msgArr[0]=="413")
            {
                $("textarea[name=‘Oldip‘]").html(msgArr[1]);
            }
            else
            {
                alert(msgArr[1]);
            }
            //alert(msg[1]);
        }
    }
    )
}

function transferip()
{
    var site_list=$("textarea[name=‘Oldsite‘]").val();
    var ip_list=$("textarea[name=‘Oldip‘]").val();
    var ip_new=$("input[name=‘Newip‘]").val();
    /*var del_go=$("input[name=‘deloldsite‘][checked]").val(); 
    var check_go=$("input[name=‘checksiteinfo‘][checked]").val();*/ 
    if(ip_list==""||ip_new=="")
    {
        alert(‘IT CANNOT BE EMPTY!‘);
        return false;
    }
    ajaxStar("LOADING...");
    $.ajax(
    {
        type:"post",
        url:"transip.asp",
        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();
            //alert(msg);
            var msgArr=msg.split("-|-")
            if(msgArr[0]=="413")
            {
                alert(msgArr[1]);
            }
            else
            {
                alert(msgArr[1]);
            }
            //alert(msg[1]);
            //location.reload();
        }
    }
    )
}

/**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";
}

图片地址:微云->工作->代码->加载中Ajax->images

AJAX遮罩实例