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???

Reply via email to