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

  • SEARCH
  • Home
  • 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 8788047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:03:28+00:00 2026-06-13T22:03:28+00:00

I am banging my head against a wall here, trying to figure out why

  • 0

I am banging my head against a wall here, trying to figure out why I can’t get this to work. I have tried following many examples and have stripped everything I have tried down to what I have below.

So, on my aspx page, I have:

<input type="radio" data-bind="value: individual" />Individual

Here is my javascript:

var serviceBase = 'http://localhost:49906/PopulationSelection.aspx/';
var getSvcUrl = function (method) { return serviceBase + method; };

var ajaxGetJson = function (method, jsonIn, callback) {
    $.ajax({
        url: getSvcUrl(method),
        type: "GET",
        data: ko.toJSON(jsonIn),
        dataType: "json",
        contentType: "application/json",
        success: function (json) {
            callback(json.d);
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(xhr + ' ' + thrownError);
        }
    });
}

var batchesDataService = {
    getSavedBatches: function (callback) {
        ajaxGetJson("GetBatches", null, callback);
    }
};

var Batch = function (p) {
    this.individual = ko.observable(p.Individual);
    this.household = ko.observable(p.Household);
    this.countOnly = ko.observable(p.CountOnly);
    this.femalePrimary = ko.observable(p.FemalePrimary);
    this.eventManagement = ko.observable(p.EventManagement);
    this.eventManagementText = ko.observable(p.EventManagementText);
    this.randomSampling = ko.observable(p.RandomSampling);
    this.randomSamplingText = ko.observable(p.RandomSamplingText);
    this.stateHasChanged = ko.observable(false);
};

var loadBatchesCallback = function (data) {
    var parsed = JSON.parse(data);
    myViewModel.Batch = new Batch(parsed);
    //also tried:
    //myViewModel.Batch(new Batch(parsed));
};

var myViewModel;
var viewModel = function () {
    this.Batch = ko.observable();
    this.getBatchInfo = function () {
        batchesDataService.getSavedBatches(loadBatchesCallback);
    };
};

$(document).ready(function () {
    myViewModel = new viewModel();
    myViewModel.getBatchInfo();
    ko.applyBindings(myViewModel.Batch);
});

I am having no problem getting the data back from my webmethod (using for Session access) and I see the correct info when I alert the Batch members.

My problem comes with the actual ko.applyBindings(). No matter what I have tried, I get the following error in the Console:

Uncaught Error: Unable to parse bindings.
Message: ReferenceError: individual is not defined;
Bindings value: value: individual 

Any help is appreciated!

  • 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-13T22:03:31+00:00Added an answer on June 13, 2026 at 10:03 pm

    Asynchronicity.

    You are calling ko.applyBindings before the ajax callback is getting called, so it doesn’t have the value yet.

    You may want to call applyBindings somewhere in your callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been banging my head against the wall trying to figure out this
I've been banging my head against the wall all night trying to figure out
I have been banging my head against the wall trying to get Exscript installed.
I've been banging my head against the wall trying to figure out where I'm
Django advanced beginner here. I'm banging my head against the wall trying to figure
I've been banging my head against the wall for awhile on this but here
I have been banging my head against the wall with this odd behaviour on
I'm banging my head against a wall trying to get either AttributeExchange or SimpleRegistration
I'm banging my head against a wall with this one. I have raphael js
I've been banging my head against the wall with this one. I have a

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.