I'm receiving a JSON string and attempting to map it to a KOJS VM, but I don't see why the below code isn't working.
Here's my JS file:
var viewModel = {};
$.ajax({
url: '../data/settings',
cache: false,
success: function(data) {
alert(data);
viewModel = ko.mapping.fromJS(data);
ko.applyBindings(viewModel);
}
});
The first alert displays:
{"remember":"false"}
My HTML, which isn't working is:
<span data-bind="value:remember"></span>
Do you know what might be going wrong here? Thanks!