XmlHttpRequest的post,参数为空?
function doRequestUsingPOST() {
createXMLHttpRequest();
var url = "dogp.aspx?timeStamp= " + new Date().getTime();
var queryString = createQueryString();
xmlHttp.open( "POST ", url, true);
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded ");
xmlHttp.send(queryString);
}
服务器端:
string firstname = this.Request.QueryString[ "FirstName "];
string middlename = this.Request.QueryString[ "MiddleName "];
string birthday = this.Request.QueryString[ "Birthday "];
StringBuilder sb = new StringBuilder();
sb.Append( "Hello ").Append(firstname).Append( " ").Append(middlename);
sb.Append( ".Your birthday is ").Append(birthday).Append( ". [Method ").Append(this.Request.RequestType).Append( "] ");
this.Response.Write(sb.ToString());
this.Response.Flush();
this.Response.Close();
为什么参数传过来都是空的?
------解决方案--------------------好像这么写:string firstname = this.Request.Parms[ "FirstName "];
------解决方案--------------------在Params集合里找