1 回答
TA贡献1998条经验 获得超6个赞
function UserInfo(str) { //method starts with str as an argument
var string = str; //str is assigned to string.
var http = new XMLHttpRequest(); // create new HttpRequest instance
var url = "testing.php"; //the script to call to post data
var params = 'id=string';
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
// Call a function when the state changes.
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);
}
- 1 回答
- 0 关注
- 144 浏览
添加回答
举报