Hi selecta, the DIV is rendered fine in my tests, no need to add any prefix such as '.html' or '.load' for it to work.
But having a LOAD in the controller generates an unnecessary ajax call, and having the script action and view just makes web2py work harder instead of letting the web server do it from static, not to mention the clutter of having js all over your views directory. Sorry, but I fail to see any benefit. Maybe I am missing something... On May 4, 9:17 am, selecta <gr...@delarue-berlin.de> wrote: > I always wondered how I could separate my JavaScript from the rest of > my HTML > It came to me and it worked almost well > > controllers/default.py > > def index(): > response.files.append(URL(request.application,'default','script.js')) > return dict(content = LOAD('default', 'strange', ajax=True)) > > def script(): > return dict() > > def strange(): > return DIV('this div is not rendered as html') > > views/script.js > function foobar(){ > // so nice no js in html, but pure js in here > > } > > no the inclusion of the js file works nice, but as the loaded > component strange is loaded as js > this can be prevented by explicitly calling it as html > return dict(content = LOAD('default', 'strange.html', ajax=True)) > > but shouldnt the default extension stay html in this case???