传递价值观?你的意思是参数?如是:
首先创建一个AJAX obj:var http = new XMLHttpRequest();
GET方法:
var url = "load.php";
var params = "loadNo=loadNo¶m=value";
http.open("GET", url+"?"+params, true);
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(null);POST方法:
var url = "laod.php";
var params = "loadNo=loadNo¶m=value";
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);