DIV CSS 佈局教程網

AJAX之xmlHttp
編輯:AJAX詳解     

<script type="text/Javascript" language="Javascript">
        <!--
        //以XML求取數據
        function XMLPost(theEmail)
        {
          var webFileUrl = "../User/CheckUser.ASPx?LogonName=" + theEmail;
          var result = "";
                   
          if (window.ActiveXObject) {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            else if (window.XMLHttpRequest) {
            xmlHttp = new XMLHttpRequest();
            }

          //var xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
          XMLHttp.open("POST", webFileUrl, false);
          XMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");   
          XMLHttp.send("");               
                 
            XMLHttp.onreadystatechange=function()
            {
                if (XMLHttp.readyState==4)
                {
                    result = XMLHttp.responseText;
                }
            }
            if(XMLHttp.status!=200)
            {
                alert ('網絡故障(xmlHttp.status='+XMLHttp.status+'),請稍後再試!');
            }
               
            result = XMLHttp.responseText; 
          result = result.substring(0,result.indexOf("?EX"));
         
          if(result != "false")
          {           
            return true;
          }
          else
          {
            return false;
          }
        }
        //-->
    </script>''' <summary>
''' 檢測用戶是否存在<文件名:../User/CheckUser.ASPx>
''' </summary>
''' <remarks>Created by dzh @2006/06/27 18:22</remarks>
Partial Class Web_User_CheckUser
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.QueryString("LogonName") Is Nothing Then
            Response.Write("false" + "?EX")
            Response.End()
            Exit Sub
        End If

        If (New EasyClick.EasyBusiness.UserBusiness).GetUserByLogonName(Request.QueryString("LogonName").ToString) Is Nothing Then
            Response.Write("false" + "?EX")
            Response.End()
            Exit Sub
        Else
            Response.Write("true" + "?EX")
            Response.End()
            Exit Sub
        End If
    End Sub
End Class

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved