Using hidden fields for single page apps

A

Andrew Burton

I'm poking at a small "single page application" (SPA), ala TiddlyWiki,
to act as kind of a local, single-user version of Twitter (no real
application, except to familiarize myself with JavaScript). Right now
I'm using a hidden field to hold JSON, which is currently my flat-file
database of posts.

Is there a better way to store JSON data in a SPA other than hidden
fields? I'm Googling now to allay or confirm my concerns, but I'm
worried that there may be some upper limit to how much data you can cram
in the value of one.

I'm using JSON mostly because (a) I really prefer it to XML in
JavaScript applications, (b) it seems (key word, "seems") smart to
separate my post data from posts (so I can show n-number of posts at a
time), and (c) I really dislike parsing XML in JavaScript when JSON
seems like a viable alternative. (Though, given my size/space if JSON
isn't going to work, I'm not averse to using XML.)

Any suggestions would be welcomed. Thanks!
 
G

Geoffrey Summerhayes

I'm poking at a small "single page application" (SPA), ala TiddlyWiki,
to act as kind of a local, single-user version of Twitter (no real
application, except to familiarize myself with JavaScript). Right now
I'm using a hidden field to hold JSON, which is currently my flat-file
database of posts.

Is there a better way to store JSON data in a SPA other than hidden
fields? I'm Googling now to allay or confirm my concerns, but I'm
worried that there may be some upper limit to how much data you can cram
in the value of one.

I'm using JSON mostly because (a) I really prefer it to XML in
JavaScript applications, (b) it seems (key word, "seems") smart to
separate my post data from posts (so I can show n-number of posts at a
time), and (c) I really dislike parsing XML in JavaScript when JSON
seems like a viable alternative. (Though, given my size/space if JSON
isn't going to work, I'm not averse to using XML.)

Any suggestions would be welcomed. Thanks!


What are you doing with the hidden field? The only
thing I'm using JSON for is passing information through
AJAX. It just gets eval'd, put into more complete
javascript objects, and plopped into arrays and variables.
Once the information is moved into the page's object system
there's not much point in keeping the original JSON around.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top