function btnClick() {
            var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            if (!xmlhttp) {
                alert("创建xmlhttp对角异常");
            }
            xmlhttp.open("POST", "GateDate.ashx", false);
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {
                        document.getElementById("Text1").value = xmlhttp.responseText;
                    }
                    else {
                        alert("AJAX服务器返回错误!");
                    }
                }
            }
            xmlhttp.send();           
        } 

或者使用JQUERY

   function btnClick() {
            $.post("GateDate.ashx", function(data, textStatus) {
                if (textStatus = "success") {
                    alert(data);
                }
                else {
                    alert("failse");
                }

            });        
        }