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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:57:33+00:00 2026-05-18T10:57:33+00:00

I need to store data temporarily at the client-side to allow users to add,

  • 0

I need to store data temporarily at the client-side to allow users to add, edit or delete items without having to query the server for each of these actions; just when the user finishes adding items and clicks on the Add button, the list is sent to the server to be saved permanently.

This image describes what I want to achieve.
I know I have to use arrays in JavaScript, but I don’t know how to create one to store objects (in this case Detail which contains :id, price and description).

I hope you can help me out.
Thanks in advance.
PS: I’m using JSP and… sorry for my English

  • 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-18T10:57:34+00:00Added an answer on May 18, 2026 at 10:57 am

    Sure, since it’s a table it makes sense to have an array of objects. Note that an object is surrounded by curly braces and an array is surrounded by brackets:

    var myArray = [];  // Initialize empty array
    var myObject = {}; // Initialize empty object
    

    This should accomplish what you need:

    // Initialize variables
    var newEntry, table = [];
    
    // Create a new object
    newEntry = {
      id: '',
      price: '',
      description: ''
    };
    
    // Add the object to the end of the array
    table.push(newEntry);
    

    Which is the same as this:

    // Initialize array
    var table = [];
    
    // Create object and add the object to the end of the array
    table.push({
      id: '22',
      price: '$222',
      description: 'Foo'
    });
    

    You can now access properties like this:
    table[0].id; // ’22’

    On modern browsers, if you want the data to persist across sessions (like cookies) you could use the sessionStorage or localStorage objects.

    When you want to send the data to the server, you’ll send a JSON version of the table across the wire:

    var data = JSON.stringify(table);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running ASP.NET MVC and need a safe way to store credit-card data temporarily
I need to collect some data and temporarily store it in memory and then
In my Android app, I need to temporarily store some data in a form
I need to store data, the problem is that I only know the name
I am creating a windows phone application, which need to store some data in
I'm writing a program in C# that will need to store a few Data
I need to store a lot of data coming in from a server into
I want to store some data during my site viewing. Sometime i need to
I´ve a Javascript object with all the data that I need to store on
Ok, I need to store/retrieve a bit from a data table of 3.268.760 bits

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.