【发布时间】:2016-04-02 06:31:18
【问题描述】:
如何使用angularjs 将参数发布到[WebMethod]。
我的 angularjs 脚本是::
app.factory('checkAvabService', function ($http) {
return {
checkFare: function () {
return $http.post('onewaydomflt.aspx/checkAvab', {
data:{test:"hello"} //post test as parameter to web method
})
}
};
});
我的网络方法是::
[System.Web.Services.WebMethod]
public static string checkAvab(string test) // string test is not accept value "hello"
{
string x = test;
return x;
}
这里我没有得到 test 参数值 hello 到WebMethod。
这段代码有什么问题。
【问题讨论】:
标签: c# asp.net .net angularjs webmethod