What is the best way to add dynamic content to JavaScript, especially configuration settings?
A couple possibilities are:
- Place the content in a dynamically generated file (e.g., JSP, PHP, etc.) rather than a JavaScript file, perhaps using an object literal.
- Request the content from the server via ajax as JSON.