469,333 Members | 4,596 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,333 developers. It's quick & easy.

Using hidden fields for single page apps

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!

--
Andrew Burton
tu*********@aol.com
http://utilitarian.us - A Guide to Esoteric Technology in Paragon City
http://jarodrussell.livejournal.com/ - Take a guess. ;)
Jun 8 '07 #1
1 2457
On Jun 8, 3:04 pm, Andrew Burton <tuglyrai...@aol.comwrote:
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.

---
Geoff

Jun 8 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ed Jay | last post: by
4 posts views Thread by Mark | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.