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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:59:16+00:00 2026-06-13T18:59:16+00:00

I am writing to a generic list where each item holds two values, I’m

  • 0

I am writing to a generic list where each item holds two values, I’m writing the variables name and valCount to the list.

I have to posts in my page load and i think this is the reason i only get the value 0 returned.

The value i am having issues with is valCount in the post $.post("Dashboard/UserValuationGet" the val count is declared before that method and set to 0.

Even if i set the code to valCount = 5 in the post method that value is still lost, How could i keep that value? is there a way to use session in jQuery?

$(document).ready(function () 
    {
        $.post("Dashboard/UsersGet", {}, function (dataSet) 
        {
            var obj = jQuery.parseJSON(dataSet);
            var table = obj.Table;
            var countUsers = 0;
            lis = '';
            for (var i = 0, len = table.length; i < len; i++) 
            {
                var array = table[i];
                if (array.Active == 1) 
                {
                    var name = array.Name;
                    valCount = 0;
                    $.post("Dashboard/UserValuationGet", {}, function (dataSet1) 
                    {
                        var obj1 = jQuery.parseJSON(dataSet1);
                        var table1 = obj1.Table;
                        for (var i = 0, len = table1.length; i < len; i++) 
                        {
                            valCount += 1;
                        }
                    });
                    lis += '<li class="subitem1"><a href="#">' + name + '<span>' + valCount + '</span></a></li>';                    
                    countUsers = countUsers + 1;
                }
            }
            $("#UserList").empty().html(lis);
            $('#userCount').html(countUsers.toString());

        });
    });
  • 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-13T18:59:18+00:00Added an answer on June 13, 2026 at 6:59 pm

    Archer got that bang on.

    If you are insistent on server storage, it would be make server round-trip calls and save variables on session and retrieve when needed. Use $.ajax() to set or get data

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

Sidebar

Related Questions

If I have a base class that inherits from a generic list, and the
If I have a base class that inherits from a generic list, and the
I am writing a generic repository to interface with EF using DBContext. I have
I am writing a generic linked list in C++ using templates, and am experiencing
I am writing a generic extension method for IEnumerable for mapping a list of
I'm (re)writing a program that does generic unit test scheduling. The current program is
I have a series of urls tied to Django's generic date views. In the
.NET offers a generic list container whose performance is almost identical (see Performance of
I'm writing a generic type to handle the underlying Active Directory objects such as
I want to create a generic List<> whose type is declared at runtime. I

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.