I just went through knockouts and watched the video presented on the site . its quite interesting how we can improve our js code using knockout. I also looked at examples where it creates nested or main forms of forms, but these forms are always passed through ajax. Is there a way to post a nested form without ajax without breaking asp.net mvc default modelbinding. In particular, I want the behavior, as in this demo version of the code , I created some time ago . but now I want to do this with knockoutjs and without ajax
Take a look at the answer to this question: Submit json to MVC3 action
It describes how to use the utility function ko.utils.postJsonto submit part or all of your viewing model using a regular form entry. This requires an attribute on the .NET side in order to properly deserialize it from the form message (as opposed to using AJAX with the content type set to JSON).
ko.utils.postJson
, , Knockout : https://groups.google.com/d/topic/knockoutjs/eCQo4yzCSAc/discussion , : https://groups.google.com/d/topic/knockoutjs/3FEpocpApA4/discussion
, ko.utils.postJson(url, ko.toJSON(viewModel))
ko.utils.postJson(url, ko.toJSON(viewModel))