Skip to content

Instantly share code, notes, and snippets.

@DrewDouglass
Created January 24, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrewDouglass/dceded05e730067813b56e47d01cda32 to your computer and use it in GitHub Desktop.
Save DrewDouglass/dceded05e730067813b56e47d01cda32 to your computer and use it in GitHub Desktop.
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