Is it possible to create an object in view and send it to the controller via ajax?
That's right. You can use ASP.NET MVC model bindings for this.
var data = { Id: 5, Value: "Hello, world!" }; $.post('Home/MyAction', data);
And you should have the appropriate POCO:
public class MyPoco { public int Id { get; set; } public string Value { get; set; } }
And the action that binds your model:
public ActionResult MyAction(MyPoco myPoco) { if(ModelState.IsValid) {
This should automatically deserialize your request into POCO.
source share