// Build the URL to connect to
var url = "ValidateName.aspx";
// Open a connection to the server
xmlHttp.open("POST", url, true);
// Setup a function for the server to run when it's done
xmlHttp.onreadystatechange = callBack_CheckName;
xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
// Send the request
xmlHttp.send("name=" + escape(name) );
后台如何接收参数:
Request.Form["name"]
2、使用Get方式:
客户端代码:
// Create XMLHttpRequest object
CreateXmlHttp();
// Build the URL to connect to
var url = "ValidateName.aspx?name=" + escape(name);
// Open a connection to the server
xmlHttp.open("GET", url, true);
// Setup a function for the server to run when it's done
xmlHttp.onreadystatechange = callBack_CheckName;
// Send the request
xmlHttp.send(null );
后台如何接收参数:
Request.QueryString["name"]