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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:23:05+00:00 2026-06-10T05:23:05+00:00

I am attempting to pull down data from a JSON response that I wrote

  • 0

I am attempting to pull down data from a JSON response that I wrote in MVC4 using the knockout.js library. I have these three areas that need to be populated, the first of which is a multi-select box. I have looked at examples online as well as references, and fiddlers linked here, to no avail. The area that I’m having an issue with is populating the arrayTwo and grid arrays with all of the data that comes down for each of the items that were selected in the arrayOne list.

function viewModel() {
    this.arrayOne = ko.observableArray();
    this.chosenarrayOne = ko.observableArray();
    this.arrayTwo = ko.observableArray();
    this.gridArray = ko.observableArray();
    this.chosenarrayTwo = ko.observableArray();
    this.chosenarrayOne.subscribe(function (nIds) {
        mvvm.arrayTwo(undefined);
        mvvm.gridArray(undefined);
        var nDx;
        if (nIds != null) {
            for (nDx = 0; nDx < nIds.length; nDx++) {
                $.ajax({
                    url: '{Working URL Omitted}',
                    data: { nValue: arrayOne[nDx] },
                    type: 'GET',
                    success: function (data) {
                        mvvm.arrayTwo(data);
                    },
                    error: function () {
                        alert('Array Two ajax error');
                    }
                });
                $.ajax({
                    url: '{Working URL Omitted}',
                    type: 'GET',
                    data: { nValue: nIds[nDx] },
                    success: function (data) {
// Example of what I would like to happen, however I get nothing back
                        mvvm.gridArray.arrayPushAll(data);

                        //mvvm.gridArray(data);
                    },
                    error: function () {
                        alert('Grid Array ajax error');
                    }
                });
            }
        }
    }, this);
}
var mvvm = new viewModel();
ko.applyBindings(mvvm);
$.ajax({
    url: '{Working URL Omitted}',
    type: 'GET',
    success: function (data) {
        mvvm.arrayOne(data);
    },
    error: function () {
        alert('Array One ajax call error');
    }
});

I have tried json-ing the response to see what comes back, and the values in array form come back. However if there is more than one element in the arrayOne var, nothing comes back.

  • 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-10T05:23:07+00:00Added an answer on June 10, 2026 at 5:23 am

    In your ajax calls you are sending wrong data. If you want to get the value in observableArray you have to get like this :

    arrayOne()[nDx] instead of arrayOne[nDx]
    

    Check this example

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

Sidebar

Related Questions

I'm attempting to pull data from a page that a user is viewing and
I'm attempting to pull some data from a SQLite database so that I can
I am attempting to pull the EXIF information for images that have values for
I'm attempting to pull up all entities that have a name that doesn't partially
I've been attempting to pull hard-coded configuration data from a Tomcat web-app which I'm
I am attempting to make a program that will pull data such as OS,
I'm attempting to create an app to pull the sqlite data from a preexisting
I'm attempting to pull in data from Google's Shopping API. I'm able to download
I am attempting to pull some information from my tnsnames file using regex. I
Attempting to pull from git repo, but getting the following output. I think these

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.