请哪位大神写一下ajax的get方式和post方式的写法

比如各自传送一个数据1到test.jsp

他们的写法是????

我对get还了解一些

没用过post发送
问题补充


var xmlhttp;
if(window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
xmlhttp=new XMLHttpRequest();
}
function senddata()
{
serverpage="test.jsp?data=1";
xmlhttp.open("GET",serverpage);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{
document.getElementById("msg").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.send(null);
}


这是get方式,post方式不会写
问题补充
good,就是没有最佳答案结贴功能

[code="js"]
var xmlHttp = null;
if (window.XMLHttpRequest){
// code for IE7, Firefox, Opera, etc.
xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject){
// code for IE6, IE5
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlHttp != null){
xmlHttp.open("POST", "test.jsp", true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState === 4 && xmlHttp.status === 200){
document.write(xmlHttp.responseText);
}
}
xmlHttp.send("data=1");
}else{
alert("Your browser does not support XMLHTTP.");
}[/code]

jquery ajax 自己去查.... 这是你要的答案

$.post(url,{aa:123},callBack,'json')
参数解释:1、url:就是你的Ajax提交地址
2、就是你要提交的参数,以Json的格式传到后台,后台直接用名字(本例中为aa)接受
3、callBack:就是处理成功的回调函数,可用于一些Dom操作或弹出提示信息
4、代表你提交的和接受的结果类型,有以下几种:json text html等,具体可参见jquery api.

:wink: :cry: :lol: :o :( :) :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: [list]
[*]
[/list][code="java"][/code][quote][/quote][u][/u][i][/i][b][/b][img][/img][url][/url][flash=200,200][/flash]