How to update a JSON Object that is represented in a form

前端 未结 3 1651
刺人心
刺人心 2021-01-27 12:10

I have a JSON object that I used to create a form. This JSON object is parsed by KnockoutJS.

Now, when I modify the form, I want the JSON object to be updated according

3条回答
  •  旧时难觅i
    2021-01-27 12:54

    If your Knockout ViewModel matches your form, you could just use the built in ks.toJSON()

    http://knockoutjs.com/documentation/json-data.html

    A better option, especially if your form is large or complex, is to use either the mapping or viewmodel plug-ins

    http://knockoutjs.com/documentation/plugins-mapping.html http://coderenaissance.github.io/knockout.viewmodel/

提交回复
热议问题