日期:2014-05-18  浏览次数:20460 次

Ajax post数据在服务器端怎么取。
Ajax   post数据在服务器端怎么取。
get取没问题,post没取到

  var   url= "WebForm1.aspx ";
                        xmlHttp.open( "POST ",url,true);
                        xmlHttp.onreadystatechange   =   writeNewMessage;
                        xmlHttp.send( "action=send "+
                                                  "&lastId= "+lastId);

------解决方案--------------------
Request.Form[ "action "]

Request.Form[ "lastId "]
------解决方案--------------------
xmlHttp.send( "action=send "+
"&lastId= "+lastId);
把这个,接在URL里
xmlHttp.send( " ");试试,如果还有问题,说明是JS代码问题
------解决方案--------------------
关注,曾遇过,没解决
------解决方案--------------------
无私奉献了

<script type=text/javascript>
var XMLHttp;
function CreateXMLHttpRequest()
{
if(window.ActiveXObject)
{
XMLHttp=new ActiveXObject( "Microsoft.XMLHTTP ");
}
else if(window.XMLHttpRequest)
{
XMLHttp=new XMLHttpRequest();
}
}

function CreateQueryString()
{
//创建查询字符串
var scpID=form1.cpID.value;
var scpMC=form1.cpMC.value;
var slylb=form1.lylb.value;
var szuozhe=form1.announce_zuozhe.value;
var snote=form1.announce_note.value;
var sQueryString= "cpID= "+scpID+ "&cpMC= "+scpMC;
sQueryString+= "&lylb= "+slylb+ "&announce_zuozhe= "+szuozhe;
sQueryString+= "&announce_note= "+snote;

return sQueryString;
}

function CreateXMLString()
{
//创建XML文档
var scpID=form1.cpID.value;
var scpMC=form1.cpMC.value;
var slylb=form1.lylb.value;
var szuozhe=form1.announce_zuozhe.value;
var snote=form1.announce_note.value;
var sXMLString= " <RequestParams> ";
sXMLString+= " <Action> CPLiuyan <\/Action> ";
sXMLString+= " <cpID> "+scpID+ " <\/cpID> ";
sXMLString+= " <cpMC> "+scpMC+ " <\/cpMC> ";
sXMLString+= " <lylb> "+slylb+ " <\/lylb> ";
sXMLString+= " <announce_zuozhe> "+szuozhe+ " <\/announce_zuozhe> ";
sXMLString+= " <announce_note> "+snote+ " <\/announce_note> ";
sXMLString+= " <\/RequestParams> ";

return sXMLString;
}

function SendRequestUsingPost()
{
////利用get方法,查询串名/值作为一对附加到目标URL的后面
//CreateXMLHttpRequest();
//var PostUrl= "PostLiuyan.aspx? ";
//PostUrl+=CreateQueryString()+ "&tmpcode= "+new Date().getTime();
//XMLHttp.open( "GET ",PostUrl,true);
//XMLHttp.onreadystatechange=HandleStateChange;
//XMLHttp.send(null);

////利用post方法,把查询串作为请求体的一部分发送出去
//CreateXMLHttpRequest();
//var PostUrl= "PostLiuyan.aspx?tmpcode= "+new Date().getTime();