Raffael Luthiger wrote:
> 2) The js-script gets generated each time the page is called. And the
> corresponding vars are set in there.
>
> 3) Every time the page is loaded the js-script asks the server for a XML
> (or JSON) file with the preferences in there.
>
> 5) More (and better) ideas?
I'd use a combination of these.
This same problem plagued me for a while too, I didn't like the idea of
generating JS on the fly, and an ajax request seemed overkill,
then it suddenly struck me today:
From the backend, serialize your data as JSON, and place it in the
value attribute of a hidden input element. eg:
in HTML:
<input type="hidden" id="state" value="{hide:['section1','section2']}"/>
then in JS:
eval('var state = ' + $('#state').val());
I'm currently writing a plugin to pull JSON data from a document
like this (roughly based on XForms model/instance concepts), although
as I say I've only just started this today :)
- Mark Gibson
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/