Please quote when replying.
Matteo Latini wrote in post #969994:
What do you exactly mean by dynamic...
or ERb rather than an unchanging static .js file.
Can you provide some examples
in which having dynamic JS can lead to design/development issues?
I think the use of dynamic JS complicates things needlessly. It also
prevents the client from caching the JS file. In general, source code
(behavior) should be static and data should be dynamic. This is true on
the server side and I believe it's also true on the client side.
Dynamic code is also harder to test and debug.
Would you classify JSON as dynamic? In some way, json is just
I would classify JSON as data. Since data can be dynamic, I think it is
entirely appropriate for an Ajax request (or whatever) to return dynamic
JSON, HTML, XML, CSV, or whatever. Usually this would then be processed
Again, my principle is: dynamic data, static source code/behavior.
Rails' dynamic JS crams the data in with the source code, where it
really doesn't belong. You wouldn't do that in Ruby; don't do it in JS.
Also, what do you mean by hidden div?
A div with display: none in its style.
Do you mean you just jam
the data in it or use it for html templating?
I don't understand what you're asking.