如何在C#WebMethod中获取POST数据?
我需要使用jqueryajax请求发布值,以便在C#代码隐藏中进行处理。我可以发送数据,但我不知道如何从C#WebMethod内部检索数据如何在C#WebMethod中获取POST数据?,c#,jquery,asp.net,ajax,post,C#,Jquery,Asp.net,Ajax,Post,我需要使用jqueryajax请求发布值,以便在C#代码隐藏中进行处理。我可以发送数据,但我不知道如何从C#WebMethod内部检索数据 var cliente; $.post( "../Dados/GetDados.aspx/GetClienteById", { Id: id }, function(dado) { cliente = dado; }); C#代码: 将其添加为参数 [WebMethod] [Scrip
var cliente;
$.post(
"../Dados/GetDados.aspx/GetClienteById",
{
Id: id
},
function(dado) {
cliente = dado;
});
C#代码:
将其添加为参数
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string GetClienteById(int id)
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string GetClienteById(int id)