首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

XmlHttpRequest的post,参数替空

2011-12-17 
XmlHttpRequest的post,参数为空?functiondoRequestUsingPOST(){createXMLHttpRequest()varurldogp.aspx

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集合里找

热点排行