0

Is there any way to save variables using Jquery or javascript, besides setlocalstorage? For example: I have a product catalog website online. I made administration rights features like a window where you can add the name, picture and price of an item. That item data goes into the array using push(). But it only works locally. I want the items I add to be seen by anyone who visits my website.

var products=[["fishing rod","https://i.pinimg.com/originals/d1/1c/41/d11c419d0c75307b18e388a0c2d64907.jpg",10.99],["fishing line","https://s7d2.scene7.com/is/image/dkscdn/15SFXUSFXSG330YD6FLI_Clear_is/",3.99]];

I have 3 inputs on my window, 1 for name, 1 for img src and the last one for the price. When I click 'OK' it pushes that new array into my products array. But I want to save that array inside the folder of my online website. So that more people with admin rights can add more products and that I can see the changes online. I hope I made myself clear.

2
  • Use ajax and save datas to database. Commented Jan 24, 2018 at 21:48
  • Javascript (and consequently jQuery) that runs in the browser is entirely client-side. Everything that can be stored using cookies, localStorage, sessionStorage, WebDB, is stored on the computer running the browser. The only way for others to access what you store is to setup a server with a database. Commented Jan 24, 2018 at 22:04

1 Answer 1

2

You should use a backend that store this data in some kind of database (SQL or nosql).

Then you access it a display the content to all the users.

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

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.