如何将参数从 javascript 发送到控制器方法?例如我正在尝试发送参数“2012”
这是我视图中的脚本:
$.ajax({
type: "get", url: "test", data: {}, // How can i fill this data like @item ?
success: function (data) {
alert(data);
}
我的控制器方法:
public string test()
{
TestServices client = new TestServices();
client.ClientCredentials.UserName.UserName = "service_test";
client.ClientCredentials.UserName.Password = "..";
client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
decimal? x = client.GetTest(2012, 7, 1);
return (""+x);
}