I have a JavaScript file, and I would like to pass in a few config values to my JS file. I originally thought of using an .INI file, but I found out that the browser cannot access these System Config values. Does anyone have any suggestions to alternatives?
Asked
Active
Viewed 1,102 times
0
-
1in what context do you use this js-file? and where should the config file come from? – roeb May 19 '15 at 19:40
-
Are you talking about accessing System Configuration (msconfig) from javascript? – JGV May 19 '15 at 19:43
-
Sorry, I should clarify. My JS file makes a bunch of calls to various endpoints. Instead of updating the endpoints in the JS, I want to do the updates in a separate config file. – Jon May 19 '15 at 20:15
1 Answers
2
I store my configuration in a separate JSON file and load that into the app as a configuration object.
See this answer for examples on how to do this using Require.js or jQuery: requirejs load static JSON file