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 8565679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:28:55+00:00 2026-06-11T17:28:55+00:00

I have the following snippet JQuery inside an HTML file: $.getJSON(/events/, function (data) {

  • 0

I have the following snippet JQuery inside an HTML file:

$.getJSON("/events/", function (data) {
    viewModel = ko.mapping.fromJS(data);
    ko.applyBindings(viewModel);
});

The code is executed when, for example, the user presses a button and returns JSON like:

{"Events":[{"Name":"Event1"},{"Name":"Event2"},{"Name":"Event3"}]}

This result is linked (using KnockoutJS) to:

<ul data-bind="foreach: Events">
    <li><span data-bind="text: Name"></span></li>
</ul>

Everything works fine with the first call to $.GetJSON. I get what I want, which is (browser output):

  • Event1
  • Event2
  • Event3

But in subsequent calls to “$. GetJSON” I get the following error in Firebug:


NotFoundError: Node was not found.

containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);


And I get no list item.

What I can be doing wrong?

Thank you very much in advance.

  • 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-11T17:28:56+00:00Added an answer on June 11, 2026 at 5:28 pm

    The whole point of Knockout is to handle the interaction between your view and view model. In this case, you’re trying to update a list of events in response to a button click. The button click should be linked to a function in your view model, while the list should be linked to an observable array that’s updated when you click the button. I’ve put this together in a fiddle here: http://jsfiddle.net/mbest/uZb3e/ and the important parts are below:

    <button type=button data-bind="click: updateEvents">Update</button>
    <ul data-bind="foreach: data.Events">
        <li><span data-bind="text: Name"></span></li>
    </ul>
    

    Javascript:

    var viewModel = {
        data: ko.mapping.fromJS({"Events":[]}),
        updateEvents: function() {
            var self = this;
            $.getJSON("/events/", function (data) {
                ko.mapping.fromJS(newData, self.data);
            });​
        }
    };
    
    ko.applyBindings(viewModel);​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code (html,js,jquery) snippet ( http://jsfiddle.net/MUScJ/2/ ): <script type=text/javascript> function someFunc(){ html
I have the following simple jquery snippet $(document).ready(function () { $.ajax({ url:myjson.json, dataType: 'json',
I have the following html snippet: <div id=contentX><h1>MyHeading1</h1></div> I could select with jQuery snippet
I have the following snippet of code that loops through the jQuery animate function
I found a weird behavior of jquery's html function. I have the following code
I have the following snippet of code (I'm using jQuery 1.4.2): $.post('/Ads/GetAdStatsRow/', { 'ad_id':
In Ember.js's docs , they have a jQuery code snippet with the following syntax:
I have the following snippet of java code: File directoryToMoveTo = new File(file.getParent()+_TEMP); boolean
I have the following snippet to scroll my form to the first error: $('html,body').stop().delay(500).animate({scrollTop:
I have this following snippet in my ANT-buildfile, which reads filenames from a file

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.