This is similar to: another stack overflow q
I have tried something similar to this question:
var MyItem= { "msg": "hello word!" };
$http.post("/MyController/testPost", MyItem).success(function (data) {
Alert(ok)
})
I have also tried creating MyItem as a Javascript object.
Then in MyController:
[post]
public void testPost(MyItem MyItem)
{
}
Where MyItem, looks like this:
public class MyItem
{
public string msg;
}
The action in the controller is always hit in all scenarios, but MyItem is always has a null value for msg. Am I missing something? Is there a better way of doing this?
testPostbetestPost(MyItem RiskItem)and shouldn't your post be passing RiskItem instead of MyItem? Like$http.post("/MyController/testPost", RiskItem)?testPostdoes it get hit?