|
|
|
|
|
by Kilimanjaro
5106 days ago
|
|
Something like this may unclutter the situation, just use xmlhttprequest to get the templates on demand: //synchronous
body.innerHTML = render('blog.html',data)
//asynchronous
render('blog.html',data,body)
render=function(url,data,obj){
if url in cache: use cache
var http = xmlhttprequest()
http.get(url,obj?async:sync)
http.onready:
parse data in html
if obj: obj.innerHTML = html
else: return html
}
|
|