I am currently working on an application that utilizes two viewmodels. One is responsible for rendering a form, while the other displays a table of form data.
My issue lies in reloading the form after it has been successfully saved via an Ajax call. Even though the table reloads as expected, I haven't been able to achieve the same result with the form. Can you review the code below and provide guidance on how to approach this problem?
function FormViewModel() {
self = this;
self.loadForm = function () {
...
}
self.save = function () {
success: self.loadForm();
tvm.loadTable();
}
}
function TableViewModel() {
self = this;
self.loadTable = function () {
...
};
}
ko.applyBindings(fvm = new FormViewModel(), document.getElementById("Form"));
fvm.loadForm();
ko.applyBindings(tvm = new TableViewModel(), document.getElementById("Table"));
tvm.loadTable();