jquery ajax POST 请求 发送到Handler里面该如何接到值 以下是我的代码 json格式的也试过了
function RegisterAdd(data)
{
$.ajax({
type: "Post",
cache: false,
contentType: "application/text",
url: "/Handler/LogInRegister/QualificationRegister.ashx",
data: "name=aa",
dataType: "json",
async: false,
success: function (m) {
alert(m);
},
error: function (e) {
alert(2);
}
});
}
[WebMethod]
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string methods = context.Request["name"].ToString();
string method = context.Request.Form["method"].ToString();
switch (method)
{
case "ShengShiLoad":
context.Response.Write(ShengShiJiLian());
break;
case "ShengShiID":
context.Response.Write(ShengShiJiLianID(context));
break;
}
}
去掉了contentType: "application/text",