Skip to content

Instantly share code, notes, and snippets.

@tyth
tyth / gist:3979013
Created October 30, 2012 08:36
Underscore simple template loading
function require_template(templateName) {
var template = $('#template_' + templateName);
if (template.length === 0) {
var tmpl_dir = './templates';
var tmpl_url = tmpl_dir + '/' + templateName + '.tmpl';
var tmpl_string = '';
$.ajax({
url: tmpl_url,
method: 'GET',