例子参考
http://dotnet.aspx.cc/article/4ae836f8-ccb4-4bef-90b1-25bb1a5e6433/read.aspx

解决方案 »

  1.   

    脚本 引用了prototype.js   
     //提交数据
        var url = '/CMail/Vote/RCP/RCP_AddVote.aspx?action=add&f='+Math.random();
        var myAjax = new Ajax.Request(
        url,
        {
        method: 'post',
        postBody: xml,
        onComplete: showResponse,
        onCreate: showLoading,
        asynchronous:true
        });
        function showResponse(originalRequest)
        {
          Element.hide('spanDataLoding');
          if(originalRequest.responseText=="-1")
          {
            alert("未登录,或已超时!");
          }
        }
        function showLoading()
        {
          Element.show('spanDataLoding');
        }    public partial class RCP_AddVote : ICS.SmsDisk.Base.CMailPageBase
        {
            private XmlDocument xmlDoc = null;        protected void Page_Load(object sender, EventArgs e)
            {
                if (!this.IsPower)
                {
                    Response.Write("-1");
                    return;
                }cs文件            //System.Threading.Thread.Sleep(2000);
                getPostData(HttpContext.Current);
                if (Request["action"] != null && Request["action"].ToString().ToLower() == "add")
                {
                    AddDate();
                }        }
      

  2.   

    脚本  引用了prototype.js        
     //提交数据  
           var  url  =  '/CMail/Vote/RCP/RCP_AddVote.aspx?action=add&f='+Math.random();  
           var  myAjax  =  new  Ajax.Request(  
           url,  
           {  
           method:  'post',  
           postBody:  xml,  
           onComplete:  showResponse,  
           onCreate:  showLoading,  
           asynchronous:true  
           });  
           function  showResponse(originalRequest)  
           {  
               Element.hide('spanDataLoding');  
               if(originalRequest.responseText==  "-1  ")  
               {  
                   alert(  "未登录,或已超时!  ");  
               }  
           }  
           function  showLoading()  
           {  
               Element.show('spanDataLoding');  
           }  
      cs文件        public  partial  class  RCP_AddVote  :  ICS.SmsDisk.Base.CMailPageBase  
           {  
                   private  XmlDocument  xmlDoc  =  null;  
     
                   protected  void  Page_Load(object  sender,  EventArgs  e)  
                   {  
                           if  (!this.IsPower)  
                           {  
                                   Response.Write(  "-1  ");  
                                   return;  
                           }  
     
     
     
                           //System.Threading.Thread.Sleep(2000);  
                           getPostData(HttpContext.Current);  
                           if  (Request[  "action  "]  !=  null  &&  Request[  "action  "].ToString().ToLower()  ==    "add  ")  
                           {  
                                   AddDate();  
                           }  
     
                   }
      

  3.   

    自己结贴
     if(originalRequest.responseText==  "-1  ")  
               {  
                   alert(  "未登录,或已超时!  ");  
               }  
    引发错误