- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 10 Jun 2011 22:30:42 +0000 (UTC)
On Thu, 31 Mar 2011, Diogo Resende wrote: > > I would like your opinion on this use case: > > I have an app divided in several modules, each one has a javascript code > that needs to run to show the module page and init the interactions. The > app is not supposed to reload to show each module. > > What is the best way to fetch the javascript code and run it? Add a > <script> for that module and remove it when switching to another module? > Download using AJAX or other technology and use eval()? I'm not sure I understand the use case exactly. If you just mean that you have several different "panels" or "modes" that the user can switch between, then I would recommend just having several <section> elements, one for each module, and all but the active one have a hidden="" attribute. Script-wise, you'd just have each script loaded and active from the start, they'd just only work with their own sections. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 10 June 2011 15:30:42 UTC