It seems that after lazy load runs it stores the value of view model internal to the $.get, so when an action button is called it has no idea what "viewModel" is, so it throws a javascript error.
EX:
a data-bind="click : function() {executeOnServer(viewModel, '/api/Address/322');}"
a data-bind="click : function() {executeOnServer(viewModel, '/api/Address/322');}"
<script type="text/javascript">
$(document).ready(function() {$.ajax({ url: '/api/Address/1', type: 'POST', success: function (data) {
var viewModel = ko.mapping.fromJS(data);
ko.applyBindings(viewModel);
}, error: function (error) { alert('There was an error posting the data to the server: ' + error.responseText); } });
});
It seems that after lazy load runs it stores the value of view model internal to the $.get, so when an action button is called it has no idea what "viewModel" is, so it throws a javascript error.
EX:
a data-bind="click : function() {executeOnServer(viewModel, '/api/Address/322');}" a data-bind="click : function() {executeOnServer(viewModel, '/api/Address/322');}"
$(document).ready(function() {$.ajax({ url: '/api/Address/1', type: 'POST', success: function (data) { var viewModel = ko.mapping.fromJS(data); ko.applyBindings(viewModel); }, error: function (error) { alert('There was an error posting the data to the server: ' + error.responseText); } }); });