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 need to store some data in a Django model. These data are not
I usually use C++ stdlib map whenever I need to store some data associated
I need to store some sensitive data by encrypting it with atleast 128 bit
I need to store a tree data structure in my database, for which I
I need to store large amounts of metering data in a database. A record
I need to store of 100-200 data in mysql, the data which would be
I have a large amount of data I need to store, and be able
What is the best way to store string data across postback. I need to
I need to develop an application which stores data in a SQL Server 2005
I need to write a Stored procedure in SQL server whose data returned will

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.