AJAX源码

<script  type="text/javascript">
            function btnClick()
            {
                var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                if(!xmlHttp)
                {
                    alert("创建XMLHTTP对象出错");
                    return false;
                }
                xmlHttp.open("Post","AjaxHandler.ashx?ts"+new date(),false);
                xmlHttp.onreadystatechange=function()
                {
                    if(xmlHttp.readyState==4){
                        if(xmlHttp.status==200){
                            document.getElementById("Text1").value=xmlHttp.responseText;
                        }
                        else {
                            alert("AJAX返回值错误");
                        }
                    }
                }
                xmlHttp.send();
            }
    </script>

 

posted @ 2013-03-03 11:11  觉信  阅读(124)  评论(0编辑  收藏  举报