AJAX之xmlHttp

分类: Ajax   出处:iocblog整理  更新时间:2008-05-24   添加到收藏  

<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[来源www.iocblog.net]
            response.write("false" + "?ex")
            response.end()
            exit sub
        else
            response.write("true" + "?ex")
            response.end()
            exit sub
        end if
    end sub
end class
[来源www.iocblog.net]


Tag: xmlHttp



文章整理:iocblog
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。