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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:36:52+00:00 2026-06-13T23:36:52+00:00

I am using ColdFusion 8 and jQuery 1.8. I have some info coming out

  • 0

I am using ColdFusion 8 and jQuery 1.8.

I have some info coming out of a database and being populated into divs like this:

<div class='SpecInfo' data-height='10' data-width='23' data-length='156'></div>
<div class='SpecInfo' data-height='20' data-width='21' data-length='159'></div>
<div class='SpecInfo' data-height='30' data-width='25' data-length='154'></div>
<div class='SpecInfo' data-height='40' data-width='27' data-length='155'></div>
<input type='button' id='GoButton' value='Go!'>

I need to pull out that information and put it into an array and pass it to a CFC. I have a function that collects the data. It looks like this:

// SET VARS
$GoButton = $("#GoButton"),
    SpecArray = {
        Height: [],
        Width: [],
        Length: []
    };

// GO
var go = function() {
    var $SpecInfo = $(".SpecInfo"),
        SpecInfoLen = $SpecInfo.length,
        H, 
        W,
        L;
    for (i = 0; i < SpecInfoLen; i++) {
        var H = $SpecInfo.eq(i).data('height'),
            W = $SpecInfo.eq(i).data('width'),
            L = $SpecInfo.eq(i).data('length');
        // add H,W,L values to spec array
        SpecArray['Height'].push(H);
        SpecArray['Width'].push(W);
        SpecArray['Length'].push(L);
    }
    // stringify spec array
    // pass spec array to cfc
    alert(SpecArray['Height'].length);
}
$GoButton.click(go);

What this gives me is an array of heights, an array of widths, and an array of lengths. This is not what I want. My info is organized like this

[10,20,30,40]
[23,21,25,27]
[156,159,154,155]

For each div, I want all of the attributes in a single place. I want something more like this:

[10,23,156]
[20,21,159]
[30,25,154]
[40,27,155]

What am I doing wrong? How do I organize my array?

  • 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-13T23:36:54+00:00Added an answer on June 13, 2026 at 11:36 pm

    So why do you put all the data in 3 separate arrays instead of an array of objects?

    Instead of

        SpecArray['Height'].push(H);
        SpecArray['Width'].push(W);
        SpecArray['Length'].push(L);
    

    use

        SpecArray.push( { 'height': H, 'width': W, 'length': L } );
    

    This results in an array of objects like the following:

    [
     { 'height': 10, 'width': 23, 'length': 156 },
     { 'height': 20, 'width': 21, 'length': 159 },
     { 'height': 30, 'width': 25, 'length': 154 },
     { 'height': 40, 'width': 27, 'length': 155 }
    ]
    

    You have to init SpecArray as an array, though, and not as an object containing 3 arrays.

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

Sidebar

Related Questions

I am using ColdFusion 8 and jQuery 1.7. ** This is a programming question,
I'm using Coldfusion ORM (Hibernate), and have a cfc mapped to a database table.
I'm using coldfusion and jquery. This is my first real go at jquery and
I am using ColdFusion (Railo 3.3), and I have several forms using jQuery that
I am using ColdFusion 9 and jQuery. I am using CFAJAXPROXY. I have am
I have this HTML: <input type=text id=query data-source=whatever> I have some jQuery that changes
Using ColdFusion 8 I usually escape all my form inputs like so: <input id=foo
I am using ColdFusion to encrypt and decrypt. I have variable active with a
Is there a way to access the windows registry system using coldfusion. Something like
I am using this new jQuery plugin called jsTree www.jstree.com and using the HTML

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.