怎么获取http post请求传输的数据

2025-02-23 07:38:12
推荐回答(1个)
回答1:

Query Ajax POST提交数据

JavaScript code?

$.post("url",data,callback);

例: $.post("test.ashx",{"uname":$("#txtuname").val(),"pwd":$("#txtpwd").val()},function(data,status){
if(status!="success"){ return; }
alert(data);
});

后台接收数据

C# code?

string strUname = context.Request.Params.Get("uname");

string strPwd = context.Request.Params.Get("pwd");
if(!string.IsNullOrEmpty(strUname)&&!string.IsNullOrEmpty(strPwd))
{
//你的操作
}