I want to fill a .js file with text from a select statement. The data from the select statement would be menu items, as I want to control the items in the menu from a DB form. In Other words, I want the query to read the items from a table and inserts them into a js file so that then the menu displays those items in the page.
In order to do this, I first need to know how to open a file and enter data into it. Could anyone please show me how with a simple example. (Please, don´t skip any detail on take anything for granted, as I am pretty new on this language...)
Thanks
LaterYou shouldn't modify an external .js file. Such files are cached on the visitor's computer. This means that their browser is likely to use anold version of the .js file, and not your new one. Your site will not then function as you intend.
Dynamic javascript must therefore be on the page itself, so that a fresh copy is always included with the new page.
Are you using a Javascript menu builder? If so, visit the page where you obtained this javascript file. They will likely have samples of thedynamic javascript that goes on the page. You will see by their examples that you do not need to modify the .js file.
0 comments:
Post a Comment