i am using knockout on web application which displays the data with a foreach (all needed libraries are included)
and i get the following error:
Err
The problem is most likely that you are using fromJSON
when you really mean fromJS
. $.getJSON
will already create an object for you while ko.mapping.fromJSON
reads in a JSON string. ko.mapping.fromJS
reads in a Javascript Object.
See this JSFiddle for more: http://jsfiddle.net/hB3Rm/
Essentially, change this line:
Listing_ViewModel = ko.mapping.fromJSON(data);
to this line:
Listing_ViewModel = ko.mapping.fromJS(data);