Background:
- I have a MVC2 project and am using jQuery 1.4.2.
- I have a .NET class that I put into a view using a JsonResult.
- The page then uses jQuery to do stuff which will result in properties of the object put on the page by item (2) above.
- When a certain page element is clicked jQuery $.post's the JSON.stringify(myObj) back to action method.
What I'd like to be able to have is something like:
[HttpPost] public ViewResult MyAction(MyClass minime) { }
... MyClass would be the .NET class to deserialize the JSON into which should be fine given it was the type MyClass that got "return Json(MyClass);"
At the present time what I'm seeing is that either the object parameter is null or has no values as set by the JS/jQuery code. If I try:
MyClass foo = new MyClass(); UpdateModel(foo);
It doesn't throw an exception but similar doesn't populate the class either.
Anybody have any ideas on how to solve this? Or how to deal with JSON sent back to the action method and get it into a class.