Posting KnockOut Form data (3 mechanisms)

// MyFormController/PostMyForm

//
   $.ajax({
// Method 1
                    url: “MyForm/MyForm”,
                        method: “POST”,
                        data: self.dataModel(),
                        contentType: ‘application/x-www-form-urlencoded; charset=utf-8’, // ‘application/json’
// Method 2
                        // ## PostBack as FormCollection
                        // data: “myForm”=self.dataModel()
                        // contentType: ‘application/x-www-form-urlencoded; charset=utf-8’,
 // Need to build a JsonValueProvider
// Refer to http://haacked.com/archive/2011/06/30/whatrsquos-the-difference-between-a-value-provider-and-model-binder.aspx/
                      // ## Postback as Json
                        // data: JSON.stringify(self.dataModel())
                        // contentType: ‘application/json’
                        // dataType:”json”,
Leave a Reply

Your email address will not be published. Required fields are marked *