Sending requests to the server

It is assumed that the main logic of the model processing is hosted on the server. Every action that we perform on the model should correspond to a method in the controller:

public class FooController : KnockoutController {
  public ActionResult FooAction(FooModel model)
  {
    model.FooAction();
    return Json(model);
  }
}

As you can see from the preceding example, the method takes the model parameter that the main model sent from the client side. ASP.NET maps it to a C# object. In other words, the model parameter contains the status of the client model at the time of sending. It is possible to perform the necessary manipulations on the model and send the updated model in the JSON format with help of return Json(model);. You ...

Get Getting Started with Knockout.js for .NET Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.