can anyone please point me in the right direction for a json database on the client side for the duration of the pages life.
example:
i have a page with a canvas that i can add elements to and move them around, but i wish to create a Json object so that if an item is added to the canvas, the details are also added or updated in the json. i use asp.net MVC C#.
ideally a good example of add item and edit item and if possible using jquery but any kind of javascript would at least give me a clue.
thanks
a few clarification points:
when you say “for the duration of the pages life”, you mean without any page reloading? if so, then you don’t need storage, just put all relevant data in a variable (such as an array). the JavaScript environment won’t be lost until you reload the page.
if it will be client side only, and not stored somewhere else, you don’t need JSON. in fact there’s no such thing as a ‘JSON object’. JSON is a text representation of an object; i.e. a string. What you manipulate in JavaScript are JavaScript objects, which can be represented as JSON on a string, or constructed from a string using JSON format.
that said, if you want a multi-browser library to store JavaScript object on the client side,persist.js looks interesting. It’s a JS library that shows a common API over several incompatible solutions, including proprietary APIs, cookies and Flash.