ajax

var a = null;
try {

  a = new XMLHttpRequest();

}
catch (e) {

  try {

  a = new ActiveXObject("msxml2.xmlhttp");

  }

  catch (e) {

  alert("浏览器版本太低,请更换浏览器"); 

  }

 }
a.onreadystatechange=function()
{

  if(a.readState==4)

  {

    alert(a.responseText);

  }

}

a.open("post","index.aspx", true);//发送方式,URL,异步发送?
a.setRequestHeader("content-type", "application/x-www-form-urlencoded");//POST需要写入发送数据类型
a.send("Hello World");

posted @ 2010-12-27 17:25  晨祷  阅读(111)  评论(0编辑  收藏  举报