Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Handlebars basic function.
function templateLoad(templateName, dataSource, htmlNode, callback) {
var templateFile = 'partials/' + templateName + '.html';
jQuery.get(templateFile, function(template) {
var renderedTemplate = Handlebars.compile(template);
var result = renderedTemplate(dataSource);
//jQuery(htmlNode).replaceWith(result);
jQuery(htmlNode).append(result);
if(callback != null) {
callback();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment