【发布时间】:2017-04-06 05:42:34
【问题描述】:
我用Ajax 发送WebMethod 的参数并接收um 对象。但是,参数在WebMethod 中丢失了zeros,我发送“00001234”,在后端参数是“1234”
Ajax 代码:
var content = {valueS: "00001234" };
$.ajax({
type: "GET",
dataType: 'json',
data: content,
async: false,
url: "myPage.aspx/GetData",
contentType: "application/json; charset=utf-8",
success: function (data) { OnSucess(data); },
error: function(data) { OnError(data); }
});
网络方法代码:
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json, XmlSerializeString = false)]
public static string GetData(string valueS)
{...}
【问题讨论】:
标签: asp.net json ajax get webmethod