当先锋百科网

首页 1 2 3 4 5 6 7

 var xmlhttp;

//创建xmlhttprequest对象
        function createXMLHttpRequest()
        {
            if(window.ActiveXObject)
            {
                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
            else
            {
                xmlhttp=new XMLHttpRequest();
            }
        }

 

function startRequest(url)
        {
            createXMLHttpRequest();
            xmlhttp.onreadystatechange=handleStateChange;
            xmlhttp.open("GET",url,true);
            xmlhttp.send(null);
        }
function handleStateChange()
{
    if(xmlhttp.readyState==4)
        {
            if(xmlhttp.status==200)
            {
                var txt=xmlhttp.responseText;
                if(txt !=null && txt !="")
                { 
                    alert(txt);
                                   
                }
            }
        }
}

在请求的页面中返回你要的数据

 protected void Page_Load(object sender, EventArgs e)
    {
       string parm=  request["参数"];

       // 数据处理  select * from table where id= parm;

      Response.Clear();

     Response.Write("返回要处理的数据");

      Response.End();
  }