Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8580307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:48:04+00:00 2026-06-11T20:48:04+00:00

i am using knockout on web application which displays the data with a foreach

  • 0

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:

Error: Unable to parse bindings. Message: ReferenceError: d is not defined; Bindings value: foreach: d
[Break On This Error]   

...+c+" } ";return new Function("sc",c)},kb:function(a,b){if(b.compareDocumentPosit...

my JSON:

{"d":[{"__type":"listingItem:#applicationModel","award_text":"","channel_id":5,"constructed_short_descriptionen":"","constructed_short_descriptiongr":"","constructed_titleen":"","constructed_titlegr":"","country_id"...

My Code:

var Listing_ViewModel = {};

    var data = $.getJSON("listings.svc/Listing_Get_Items?",
                {
                    startdate: "2012-09-21 00:00:00",
                    stopdate: "2012-09-22 00:00:00",
                    channel_id: "5"
                }, function (data) {
                    // Now use this data to update your view models, 
                    // and Knockout will update your UI automatically 
                    //var parsed = JSON.parse(data);
                    alert(data.d[0].duration);
                    Listing_ViewModel = ko.mapping.fromJSON(data);
                    //alert(ko.mapping.toJS(Listing_ViewModel));
                    ko.applyBindings(Listing_ViewModel);
                    //        ko.applyBindings({
                    //          
                    //        });
                })

HTML code:

<!-- ko foreach: d -->
    <li class="item item-even" id="id_1" title="1">
    </li>
<!-- /ko -->

Any ideas what am i doing wrong? Sorry i am completely green!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:48:05+00:00Added an answer on June 11, 2026 at 8:48 pm

    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);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error on my web application using Knockout.js Cannot use
I'm building a MVC application which has a heavy client side scripting using Knockout,JQuery
I have a web application where I am using Knockout js for client. I
I'm using jQuery Mobile (jQM) and Knockout.js (ko) to develop an application. In this
I have the following code: Index.cshtml: @using System.Web.Script.Serialization @model MvcApplication3.ViewModels.PersonViewModel <script src=../../Scripts/knockout-2.1.0.js type=text/javascript></script> <!--
How, if at all, are people making web applications with client side activity using
I have the following code. Index.cshtml: @using System.Web.Script.Serialization @model MvcApplication3.Models.Person <script src=../../Scripts/knockout-2.1.0.js type=text/javascript></script> <!--
I have the following code: Index.cshtml: @using System.Web.Script.Serialization @model MvcApplication3.ViewModels.PersonViewModel <script src=../../Scripts/jquery.validate.min.js type=text/javascript></script> <script
I'm retuning a JSON object from a web service and using knockout 2.01 to
Problem: I'm using MVC4 WebAPI and am throwing an error during a Get() call.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.