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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:33:23+00:00 2026-05-31T17:33:23+00:00

I have my array populated like so: updateLabels: function () { var diagrams =

  • 0

I have my array populated like so:

updateLabels: function () {
    var diagrams = _stage.diagramLayer.getChildren();

    var componentIDs = new Array();

    for (var index = 0; index < diagrams.length; index++) {
        componentIDs.push(diagrams[index].componentID);
    }

    var self = this;
    $.ajax({
        url: '../PlanView/UpdateDiagrams',
        type: 'POST',
        data: { ComponentIDs: JSON.stringify(componentIDs), RackInfo: $('#RackInfoSelect').val() },
        success: function (data) {
            console.log('success');
        },
        error: function () {
            console.log("error");
        }
    });
    },

server side I have this method:

[CompressionFilterAttribute]
public JsonResult UpdateDiagrams(List<int> componentIDs, string rackInfo)
{
    List<object> diagramInformation = new List<object>(componentIDs.Count());
}

my data as it is being passed across the network:

ComponentIDs:[74,445,732,351,348,347,1123,599,600,1053,350,601,602,603,332,99,877,919,349,348,347,347,349,348]
RackInfo:Equipment Weight

I successfully get RackInfo, if I change UpdateDiagrams to expect List<string> then I get a list with one item in it, the entire ComponentIDs string.

What am I doing incorrectly here?

EDIT: I am working under MVC3. I should be able to leverage some sort of automatic deserialization when passing to my controller, I am just not sure how.

SOLUTION: The solution was to wrap my data object in JSON.stringify, not just componentIDs. Even though I can get the RackInfo variable server-side without converting it to JSON.

  • 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-05-31T17:33:24+00:00Added an answer on May 31, 2026 at 5:33 pm

    If you want your posted data to be in JSON format then try something like this. MVC should then be able to deserialise it automatically on the server-side.

    $.ajax({
        url: '../PlanView/UpdateDiagrams',
        type: 'POST',
        contentType: 'application/json',
        data: JSON.stringify({
            componentIDs: componentIDs,
            rackInfo: $('#RackInfoSelect').val()
        }),
        success: function (data) {
            console.log('success');
        },
        error: function () {
            console.log("error");
        }
    });
    

    (I’m unable to test it at the moment, but it should hopefully be along the right lines even if it’s not completely bug-free.)

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

Sidebar

Related Questions

I have an associative array in awk that gets populated like this: chr_count[$3]++ When
I have array defined like this : ArrayList<String> items = new ArrayList<String>(); I have
Hi I have an array adapter that is populated from an array like so:
I have an array which populated by a cookie. The length differ each time.
Hi guys i have an array that is populated with dates Array ( [0]
I have a PHP file that serves up a JSON array populated from a
I have populated an array with a few html image tags that I have
I have a UITableView which is populated by an array, I have a button
I have a nested php array. I have the first select populated already. I
I have a tree being populated by an array collection. I don't have control

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.