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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:25:58+00:00 2026-05-16T10:25:58+00:00

[UPDATE] Thanks guys,final code: var EUR_share_cost = 0; var USD_share_cost = 0; var GBP_share_cost

  • 0

[UPDATE]

Thanks guys,final code:

        var EUR_share_cost = 0;
        var USD_share_cost = 0;
        var GBP_share_cost = 0;
        var EUR_total_cost = 0;
        var USD_total_cost = 0;
        var GBP_total_cost = 0;

        $.ajax({
            url: '/producer/json/index/period/month/empties/'+empties+'/fields/'+fields+'/start/'+start+'/end/'+end+'',
            async: false,
            success: function(returned_values) {

                 $.each(returned_values.aaData, function(index, item) {

                    if (item[2] == 'EUR') {
                        EUR_share_cost  += parseFloat(item[5]);
                        EUR_total_cost  += parseFloat(item[3]);

                    } else if (item[2] == 'USD') {
                        USD_share_cost += parseFloat(item[5]);
                        USD_total_cost += parseFloat(item[3]);

                    } else if (item[2] == 'GBP') {
                        GBP_share_cost += parseFloat(item[5]);
                        GBP_total_cost += parseFloat(item[3]);
                    }
                });
            }
        });

        $('#EUR_share_cost').html(EUR_share_cost);
        $('#USD_share_cost').html(USD_share_cost);
        $('#GBP_share_cost').html(GBP_share_cost);

    }

});
  • 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-16T10:25:59+00:00Added an answer on May 16, 2026 at 10:25 am

    When you’re in $.each(), the callback has 2 parameters, the first is the index (that incrementing number you’re seeing), the second is the actual item, you’d actually want something like this:

     $.each(returned_values || {}, function(index, item) {
       console.log(item);
     });
    

    I think overall you’re looking for this:

    var eur_total = 0;
    $.each(returned_values && returned_values.aaData || {}, function(index, item) {
       if(item[2] == "EUR") eur_total += parseFloat(item[3]);
    });
    $('#EUR-total').val(eur_total);​
    

    This would total up the third column…not sure which column you’re after (maybe 5th?), you can give it a try here.

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

Sidebar

Related Questions

Update: Thanks guys, I didn't realize it was very close to zero but not
UPDATE: Thanks for all your help guys! I just need to take a litte
Update: Thanks for the suggestions guys. After further research, I’ve reformulated the question here:
Update: Thanks Ben, I decided to copy the URL to another structure and modify
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find
UPDATE: Thanks for the answers! I can't seem to figure it out, even with
UPDATE: thanks to all the answer given, but they are all about the system
Problem solved: Thanks guys, see my answer below. I have a website running in

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.