0

is there a way to save different values on session array using javascript? Here's the scenario: A user inputs a string on text box and submits it, the string will now be saved into a session array. So every time the user submits a value it will be stacked to that session array and if that array reached its maximum limit number of values be saved, all values from that session will be saved to the database and the session array values will now be emptied.

Its like a JAR and you're filling it with CANDIES... the JAR is the session array and CANDIES are values... I want to do this using javascript: Answers are very much appreciated... Thanks!

0

2 Answers 2

3

Cookies have a maximum size of 4K - that's not a lot of data. Alternatives are HTML5 local storage, or stashing it on the server.

Sign up to request clarification or add additional context in comments.

Comments

0

I see several ways:

  1. Store your values in cookies.
  2. Don't refresh the page, send the forms using AJAX; then you don't need to recreate the variables.
  3. Send the variables with the submitted form and get them back from the server script.
  4. You can create a Flash component for this, it has local storage (but I wouldn't use Flash component for such task).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.