I have my index page where I display a list of items. The index page is observable. I click on a record in the list to load the detail page where the user can modify the data. I can successfully post the modifications to the server using jQuery ajax and I am returned an updated record so I can updated the list on the index page. I can't figure out how to update the underling data for the index page with the results from posting update to server. I've tried instantiating a new IndexViewModel, but the UI doesn't reflect the new model. I've tried ko.mapping.fromJS(sourceData, targetObservableViewModel), but the UI for the Index page does not update. How can I update the underlying data for the Index page from a successful ajax submission on a totally different page?
ApplicationUtils.AjaxRequestSendData
(
'POST',
saveUrl,
dataModel,
function (jsonFromServer)
{
updateViewModel(jsonFromServer, self.activeGamesList);
history.back();
},
function (resultsFromServer)
{
alert('errror happened. not sure what happened though.');
}
);
var updateViewModel = function (sourceData, targetObservableViewModel){
ko.mapping.fromJS(sourceData, targetObservableViewModel);};
Thanks for your help.