How to post parameters to [WebMethod] using angularjs.
My angularjs script is::
app.factory('checkAvabService', function ($http) {
return {
checkFare: function () {
return $http.post('onewaydomflt.aspx/checkAvab', {
data:{test:"hello"} //post test as parameter to web method
})
}
};
});
My Web Method is::
[System.Web.Services.WebMethod]
public static string checkAvab(string test) // string test is not accept value "hello"
{
string x = test;
return x;
}
Here I am not getting test parameter value hello to WebMethod.
Whats wrong in this code.